A lot of formatting. Added more tracing levels. More Makefile fixes. Minor other changes.
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
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index c45fd7b..07900ec 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -43,7 +43,7 @@
FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64 l );
-#endif /* OLD_CALCS */
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
#else /* LONG64 */
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index 23d2a15..0864e3f 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -48,37 +48,49 @@
/* the first level must always be `trace_any' */
trace_any = 0,
- /* we start with an enum for each base component */
- trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
- trace_calc, /* calculations (ftcalc.c) */
- trace_extend, /* extension manager (ftextend.c) */
- trace_glyph, /* glyph manager (ftglyph.c) */
- trace_io, /* i/o monitoring (ftsystem.c) */
- trace_init, /* initialization (ftinit.c) */
- trace_list, /* list manager (ftlist.c) */
- trace_memory, /* memory manager (ftobjs.c) */
- trace_mm, /* MM interface (ftmm.c) */
- trace_objs, /* base objects (ftobjs.c) */
- trace_outline, /* outline management (ftoutln.c) */
- trace_raster, /* raster (ftraster.c) */
- trace_stream, /* stream manager (ftstream.c) */
-
- /* then define an enum for each TrueType driver component */
- trace_ttobjs,
- trace_ttload,
- trace_ttgload,
- trace_ttinterp,
- trace_ttcmap,
- trace_ttextend,
- trace_ttdriver,
-
- /* define an enum for each Type 1 driver component */
+ /* base components */
+ trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
+ trace_calc, /* calculations (ftcalc.c) */
+ trace_extend, /* extension manager (ftextend.c) */
+ trace_glyph, /* glyph manager (ftglyph.c) */
+ trace_io, /* i/o monitoring (ftsystem.c) */
+ trace_init, /* initialization (ftinit.c) */
+ trace_list, /* list manager (ftlist.c) */
+ trace_memory, /* memory manager (ftobjs.c) */
+ trace_mm, /* MM interface (ftmm.c) */
+ trace_objs, /* base objects (ftobjs.c) */
+ trace_outline, /* outline management (ftoutln.c) */
+ trace_raster, /* rasterizer (ftraster.c) */
+ trace_stream, /* stream manager (ftstream.c) */
+
+ /* SFNT driver components */
+ trace_sfobjs, /* SFNT object handler (sfobjs.c) */
+ trace_ttcmap, /* charmap handler (ttcmap.c) */
+ trace_ttload, /* basic TrueType tables (ttload.c) */
+ trace_ttpost, /* PS table processing (ttpost.c) */
+ trace_ttsbit, /* TrueType sbit handling (ttsbit.c) */
+
+ /* TrueType driver components */
+ trace_ttdriver, /* TT font driver (ttdriver.c) */
+ trace_ttgload, /* TT glyph loader (ttgload.c) */
+ trace_ttinterp, /* bytecode interpreter (ttinterp.c) */
+ trace_ttobjs, /* TT objects manager (ttobjs.c) */
+ trace_ttpload, /* TT data/program loader (ttpload.c) */
+
+ /* Type 1 driver components */
trace_t1objs,
trace_t1load,
trace_t1gload,
trace_t1hint,
trace_t1driver,
+ /* Type 2 driver components */
+ trace_t2driver,
+ trace_t2gload,
+ trace_t2load,
+ trace_t2objs,
+ trace_t2parse,
+
/* other trace levels */
/* the last level must always be `trace_max' */
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 2a48b23..e0fdb74 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -108,7 +108,7 @@
return root;
}
-#endif /* OLD_CALCS */
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
#ifdef LONG64
diff --git a/src/cff/cff.c b/src/cff/cff.c
index 5e0e7f0..40f6124 100644
--- a/src/cff/cff.c
+++ b/src/cff/cff.c
@@ -4,11 +4,11 @@
/* */
/* FreeType OpenType driver component (body only). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -16,29 +16,6 @@
/***************************************************************************/
- /*************************************************************************/
- /* */
- /* This file is used to compile the FreeType TrueType font driver. It */
- /* relies on all components included in the `base' layer (see the file */
- /* `ftbase.c'). The source code is located in `freetype/ttlib' and */
- /* contains: */
- /* */
- /* - a driver interface */
- /* - an object manager */
- /* - a table loader */
- /* - a glyph loader */
- /* - a glyph hinter/bytecode interpreter */
- /* - a charmap processor */
- /* - an extension manager (only used for some tools) */
- /* */
- /* Note that the engine extensions found in `freetype/ttlib/extend' are */
- /* reserved to specific tools and/or font servers; they're not part of */
- /* the `core' TrueType driver, even though they are separately linkable */
- /* to it. */
- /* */
- /*************************************************************************/
-
-
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <t2driver.c> /* driver interface */
@@ -47,4 +24,5 @@
#include <t2objs.c> /* object management */
#include <t2gload.c> /* glyph loader */
+
/* END */
diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c
index f50582b..fe29559 100644
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,9 +25,14 @@
#include <t2gload.h>
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttdriver
-
+#define FT_COMPONENT trace_t2driver
/*************************************************************************/
@@ -43,7 +48,9 @@
/*************************************************************************/
#undef PAIR_TAG
-#define PAIR_TAG( left, right ) ( ((TT_ULong)left << 16) | (TT_ULong)right )
+#define PAIR_TAG( left, right ) ( ( (TT_ULong)left << 16 ) | \
+ (TT_ULong)right )
+
/*************************************************************************/
/* */
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index b502d97..d5d066f 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -4,11 +4,11 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -22,13 +22,21 @@
#include <freetype/internal/sfnt.h>
#include <freetype/tttags.h>
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1gload
-
#include <t2load.h>
#include <t2gload.h>
- typedef enum T2_Operator_
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_t2gload
+
+
+ typedef enum T2_Operator_
{
t2_op_unknown = 0,
t2_op_rmoveto,
diff --git a/src/cff/t2load.c b/src/cff/t2load.c
index b70bff5..69db32f 100644
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -26,8 +26,16 @@
#include <t2load.h>
#include <t2parse.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttload
+#define FT_COMPONENT trace_t2load
+
/* read a CFF offset from memory */
static
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 9dff0a4..d08f8d6 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -1,14 +1,14 @@
/***************************************************************************/
/* */
-/* ttobjs.c */
+/* t2objs.c */
/* */
-/* Objects manager (body). */
+/* OpenType objects manager (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -29,9 +29,15 @@
#include <t2load.h>
#include <freetype/internal/t2errors.h>
-/* required by tracing mode */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttobjs
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_t2objs
/*************************************************************************/
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index 29d89bd..548cef2 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -1,6 +1,35 @@
+/***************************************************************************/
+/* */
+/* t2parse.c */
+/* */
+/* OpenType parser (body). */
+/* */
+/* Copyright 1996-2000 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
#include <t2parse.h>
#include <freetype/fterrors.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_t2parse
+
+
#define T2_Err_Stack_Underflow FT_Err_Invalid_Argument
#define T2_Err_Syntax_Error FT_Err_Invalid_Argument
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 79d60f9..928554b 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -24,6 +24,16 @@
/*************************************************************************/
/* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_sfobjs
+
+
+ /*************************************************************************/
+ /* */
/* <Function> */
/* Get_Name */
/* */
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index d928a45..5a6a70c 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -32,6 +32,17 @@
#include <ttpost.h>
#include <ttload.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_ttpost
+
+
/* If this configuration macro is defined, we rely on the `psnames' */
/* module to grab the glyph names. */
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 7b770c1..66e06f0 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -25,6 +25,16 @@
/*************************************************************************/
/* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_ttsbit
+
+
+ /*************************************************************************/
+ /* */
/* <Function> */
/* blit_sbit */
/* */
diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
index c160aee..642e4f7 100644
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -4,11 +4,11 @@
/* */
/* FreeType TrueType driver component (body only). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -16,29 +16,6 @@
/***************************************************************************/
- /*************************************************************************/
- /* */
- /* This file is used to compile the FreeType TrueType font driver. It */
- /* relies on all components included in the `base' layer (see the file */
- /* `ftbase.c'). The source code is located in `freetype/ttlib' and */
- /* contains: */
- /* */
- /* - a driver interface */
- /* - an object manager */
- /* - a table loader */
- /* - a glyph loader */
- /* - a glyph hinter/bytecode interpreter */
- /* - a charmap processor */
- /* - an extension manager (only used for some tools) */
- /* */
- /* Note that the engine extensions found in `freetype/ttlib/extend' are */
- /* reserved to specific tools and/or font servers; they're not part of */
- /* the `core' TrueType driver, even though they are separately linkable */
- /* to it. */
- /* */
- /*************************************************************************/
-
-
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ttdriver.c> /* driver interface */
@@ -49,4 +26,6 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <ttinterp.c> /* bytecode interpreter */
#endif
+
+
/* END */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 44d1f24..e2e3592 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
/* */
/* TrueType font driver implementation (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,11 +25,16 @@
#include <ttgload.h>
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_ttdriver
-
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -45,7 +50,8 @@
#undef PAIR_TAG
-#define PAIR_TAG( left, right ) ( ((TT_ULong)left << 16) | (TT_ULong)right )
+#define PAIR_TAG( left, right ) ( ( (TT_ULong)left << 16 ) | \
+ (TT_ULong)right )
/*************************************************************************/
@@ -70,12 +76,12 @@
/* formats. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only horizontal layouts (left-to-right & right-to-left) are */
/* supported by this function. Other layouts, or more sophisticated */
- /* kernings are out of scope of this method (the basic driver */
+ /* kernings, are out of scope of this method (the basic driver */
/* interface is meant to be simple). */
/* */
/* They can be implemented by format-specific interfaces. */
@@ -107,7 +113,7 @@
while ( left <= right )
{
- TT_Int middle = left + ((right-left) >> 1);
+ TT_Int middle = left + ( ( right - left ) >> 1 );
TT_ULong cur_pair;
@@ -118,9 +124,9 @@
goto Found;
if ( cur_pair < search_tag )
- left = middle+1;
+ left = middle + 1;
else
- right = middle-1;
+ right = middle - 1;
}
}
@@ -159,16 +165,21 @@
/* and vertical) expressed in fractional points. */
/* */
/* <Input> */
- /* char_width :: The character width expressed in 26.6 fractional */
- /* points. */
- /* char_height :: The character height expressed in 26.6 fractional */
- /* points. */
+ /* char_width :: The character width expressed in 26.6 */
+ /* fractional points. */
+ /* */
+ /* char_height :: The character height expressed in 26.6 */
+ /* fractional points. */
+ /* */
+ /* horz_resolution :: The horizontal resolution of the output device. */
+ /* */
+ /* vert_resolution :: The vertical resolution of the output device. */
/* */
/* <InOut> */
/* size :: A handle to the target size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* TrueType error code. 0 means success. */
/* */
static
TT_Error Set_Char_Sizes( TT_Size size,
@@ -181,25 +192,27 @@
TT_Face face = (TT_Face)size->root.face;
TT_Long dim_x, dim_y;
+
/* This bit flag, when set, indicates that the pixel size must be */
- /* truncated to an integer. Nearly all TrueType fonts have this */
+ /* truncated to an integer. Nearly all TrueType fonts have this */
/* bit set, as hinting won't work really well otherwise. */
/* */
/* However, for those rare fonts who do not set it, we override */
- /* the default computations performed by the base layer. I really */
- /* don't know if this is useful, but hey, that's the spec :-) */
+ /* the default computations performed by the base layer. I */
+ /* really don't know whether this is useful, but hey, that's the */
+ /* spec :-) */
/* */
- if ( (face->header.Flags & 8) == 0 )
+ if ( ( face->header.Flags & 8 ) == 0 )
{
/* Compute pixel sizes in 26.6 units */
- dim_x = (char_width * horz_resolution) / 72;
- dim_y = (char_height * vert_resolution) / 72;
+ dim_x = ( char_width * horz_resolution ) / 72;
+ dim_y = ( char_height * vert_resolution ) / 72;
metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM );
metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM );
- metrics->x_ppem = (TT_UShort)(dim_x >> 6);
- metrics->y_ppem = (TT_UShort)(dim_y >> 6);
+ metrics->x_ppem = (TT_UShort)( dim_x >> 6 );
+ metrics->y_ppem = (TT_UShort)( dim_y >> 6 );
}
size->ttmetrics.valid = FALSE;
@@ -226,17 +239,17 @@
/* size :: A handle to the target size object. */
/* */
/* <Return> */
- /* FreeType error code. 0 means success */
+ /* TrueType error code. 0 means success. */
/* */
static
TT_Error Set_Pixel_Sizes( TT_Size size,
TT_UInt pixel_width,
TT_UInt pixel_height )
{
- UNUSED(pixel_width);
- UNUSED(pixel_height);
+ UNUSED( pixel_width );
+ UNUSED( pixel_height );
- /* many things were pre-computed by the base layer */
+ /* many things have been pre-computed by the base layer */
size->ttmetrics.valid = FALSE;
@@ -257,7 +270,7 @@
/* will be loaded. */
/* */
/* size :: A handle to the source face size at which the glyph */
- /* must be scaled/loaded/etc. */
+ /* must be scaled, loaded, etc. */
/* */
/* glyph_index :: The index of the glyph in the font file. */
/* */
@@ -266,13 +279,9 @@
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
- /* <Output> */
- /* result :: A set of bit flags indicating the type of data that */
- /* was loaded in the glyph slot (outline, bitmap, */
- /* pixmap, etc). */
/* */
/* <Return> */
- /* FreeType error code. 0 means success. */
+ /* TrueType error code. 0 means success. */
/* */
static
TT_Error Load_Glyph( TT_GlyphSlot slot,
@@ -286,7 +295,7 @@
if ( !slot )
return TT_Err_Invalid_Glyph_Handle;
- /* check that we want a scaled outline or bitmap */
+ /* check whether we want a scaled outline or bitmap */
if ( !size )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
@@ -345,13 +354,14 @@
/* Glyph index. 0 means `undefined character code'. */
/* */
static
- FT_UInt Get_Char_Index( TT_CharMap charmap,
+ TT_UInt Get_Char_Index( TT_CharMap charmap,
TT_Long charcode )
{
TT_Error error;
TT_Face face;
TT_CMapTable* cmap;
+
cmap = &charmap->cmap;
face = (TT_Face)charmap->root.face;
@@ -360,9 +370,10 @@
{
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
+
error = sfnt->load_charmap( face, cmap, face->root.stream );
- if (error)
- return error;
+ if ( error )
+ return 0;
cmap->loaded = TRUE;
}
@@ -374,19 +385,34 @@
}
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** D R I V E R I N T E R F A C E ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
static
- FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface )
+ FTDriver_Interface tt_get_interface( TT_Driver driver,
+ const char* interface )
{
FT_Driver sfntd = FT_Get_Driver( driver->root.library, "sfnt" );
SFNT_Interface* sfnt;
+
/* only return the default interface from the SFNT module */
- if (sfntd)
+ if ( sfntd )
{
sfnt = (SFNT_Interface*)(sfntd->interface.format_interface);
- if (sfnt)
+ if ( sfnt )
return sfnt->get_interface( (FT_Driver)driver, interface );
}
+
return 0;
}
@@ -406,27 +432,29 @@
(void*)0,
- (FTDriver_initDriver) TT_Init_Driver,
- (FTDriver_doneDriver) TT_Done_Driver,
- (FTDriver_getInterface) tt_get_interface,
+ (FTDriver_initDriver) TT_Init_Driver,
+ (FTDriver_doneDriver) TT_Done_Driver,
+ (FTDriver_getInterface) tt_get_interface,
- (FTDriver_initFace) TT_Init_Face,
- (FTDriver_doneFace) TT_Done_Face,
- (FTDriver_getKerning) Get_Kerning,
+ (FTDriver_initFace) TT_Init_Face,
+ (FTDriver_doneFace) TT_Done_Face,
+ (FTDriver_getKerning) Get_Kerning,
- (FTDriver_initSize) TT_Init_Size,
- (FTDriver_doneSize) TT_Done_Size,
- (FTDriver_setCharSizes) Set_Char_Sizes,
- (FTDriver_setPixelSizes) Set_Pixel_Sizes,
+ (FTDriver_initSize) TT_Init_Size,
+ (FTDriver_doneSize) TT_Done_Size,
+ (FTDriver_setCharSizes) Set_Char_Sizes,
+ (FTDriver_setPixelSizes) Set_Pixel_Sizes,
- (FTDriver_initGlyphSlot) TT_Init_GlyphSlot,
- (FTDriver_doneGlyphSlot) TT_Done_GlyphSlot,
- (FTDriver_loadGlyph) Load_Glyph,
+ (FTDriver_initGlyphSlot) TT_Init_GlyphSlot,
+ (FTDriver_doneGlyphSlot) TT_Done_GlyphSlot,
+ (FTDriver_loadGlyph) Load_Glyph,
- (FTDriver_getCharIndex) Get_Char_Index,
+ (FTDriver_getCharIndex) Get_Char_Index,
};
+#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
+
/*************************************************************************/
/* */
@@ -447,13 +475,12 @@
/* format-specific interface can then be retrieved through the method */
/* interface->get_format_interface. */
/* */
-#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
-
- EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
+ EXPORT_FUNC( FT_DriverInterface* ) getDriverInterface( void )
{
return &tt_driver_interface;
}
+
#endif /* CONFIG_OPTION_DYNAMIC_DRIVERS */
diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h
index faa0015..5d94817 100644
--- a/src/truetype/ttdriver.h
+++ b/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
/* */
/* High-level TrueType driver interface (specification). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,7 +25,7 @@
#include <freetype/internal/tterrors.h>
- FT_EXPORT_VAR(const FT_DriverInterface) tt_driver_interface;
+ FT_EXPORT_VAR( const FT_DriverInterface ) tt_driver_interface;
#endif /* TTDRIVER_H */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 86fc468..5853ec8 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -4,11 +4,11 @@
/* */
/* TrueType Glyph Loader (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -29,7 +29,13 @@
#include <ttinterp.h>
#endif
- /* required for the tracing mode */
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_ttgload
@@ -50,15 +56,34 @@
#define USE_MY_METRICS 0x200
-
/*************************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Get_Metrics */
+ /* */
+ /* <Description> */
/* Returns the horizontal or vertical metrics in font units for a */
/* given glyph. The metrics are the left side bearing (resp. top */
/* side bearing) and advance width (resp. advance height). */
/* */
+ /* <Input> */
+ /* header :: A pointer to either the horizontal or vertical metrics */
+ /* structure. */
+ /* */
+ /* index :: The glyph index. */
+ /* */
+ /* <Output> */
+ /* bearing :: The bearing, either left side or top side. */
+ /* */
+ /* advance :: The advance width resp. advance height. */
+ /* */
+ /* <Note> */
+ /* This function will much probably move to another component in the */
+ /* near future, but I haven't decided which yet. */
+ /* */
LOCAL_FUNC
void TT_Get_Metrics( TT_HoriHeader* header,
- TT_UInt index,
+ TT_UInt index,
TT_Short* bearing,
TT_UShort* advance )
{
@@ -81,6 +106,7 @@
/*************************************************************************/
+ /* */
/* Returns the horizontal metrics in font units for a given glyph. */
/* If `check' is true, take care of monospaced fonts by returning the */
/* advance width maximum. */
@@ -100,6 +126,7 @@
/*************************************************************************/
+ /* */
/* Returns the advance width table for a given pixel size if it is */
/* found in the font's `hdmx' table (if any). */
/* */
@@ -126,6 +153,7 @@
/*************************************************************************/
+ /* */
/* Translates an array of coordinates. */
/* */
static
@@ -136,6 +164,7 @@
{
TT_UInt k;
+
if ( delta_x )
for ( k = 0; k < n; k++ )
coords[k].x += delta_x;
@@ -146,8 +175,8 @@
}
-
/*************************************************************************/
+ /* */
/* Mounts one glyph zone on top of another. This is needed to */
/* assemble composite glyphs. */
/* */
@@ -158,11 +187,12 @@
TT_UInt np;
TT_Int nc;
+
np = source->n_points;
nc = source->n_contours;
- target->org = source->org + np;
- target->cur = source->cur + np;
+ target->org = source->org + np;
+ target->cur = source->cur + np;
target->tags = source->tags + np;
target->contours = source->contours + nc;
@@ -173,7 +203,8 @@
#undef IS_HINTED
-#define IS_HINTED(flags) ((flags & FT_LOAD_NO_HINTING) == 0)
+#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
+
/*************************************************************************/
/* */
@@ -183,13 +214,13 @@
/* <Description> */
/* Loads a simple (i.e, non-composite) glyph. This function is used */
/* for the `Load_Simple' state of TT_Load_Glyph(). All composite */
- /* glyphs elements will be loaded with routine. */
+ /* glyphs elements will be loaded with this routine. */
/* */
static
- TT_Error Load_Simple( TT_Loader* load,
- TT_UInt byte_count,
- TT_Int n_contours,
- TT_Bool debug )
+ TT_Error Load_Simple( TT_Loader* load,
+ TT_UInt byte_count,
+ TT_Int n_contours,
+ TT_Bool debug )
{
TT_Error error;
FT_Stream stream = load->stream;
@@ -199,8 +230,8 @@
TT_UShort n_ins;
TT_Int n, n_points;
- /*********************************************************************/
- /* simple check */
+
+ /* simple check */
if ( n_contours > load->left_contours )
{
@@ -214,8 +245,7 @@
/* preparing the execution context */
mount_zone( &load->base, zone );
- /*********************************************************************/
- /* reading the contours endpoints */
+ /* reading the contours endpoints */
if ( ACCESS_Frame( byte_count ) )
return error;
@@ -227,16 +257,15 @@
if ( n_contours > 0 )
n_points = zone->contours[n_contours - 1] + 1;
-
- /*********************************************************************/
- /* reading the bytecode instructions */
+ /* reading the bytecode instructions */
n_ins = GET_UShort();
load->face->root.glyph->control_len = n_ins;
if ( n_points > load->left_points )
{
- FT_TRACE0(( "ERROR: Too many points in glyph %ld\n", load->glyph_index ));
+ FT_TRACE0(( "ERROR: Too many points in glyph %ld\n",
+ load->glyph_index ));
error = TT_Err_Too_Many_Points;
goto Fail;
}
@@ -250,7 +279,7 @@
goto Fail;
}
- if (stream->cursor + n_ins > stream->limit)
+ if ( stream->cursor + n_ins > stream->limit )
{
FT_TRACE0(( "ERROR: Instruction count mismatch!\n" ));
error = TT_Err_Too_Many_Ins;
@@ -258,27 +287,29 @@
}
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if ( (load->load_flags & (FT_LOAD_NO_SCALE|FT_LOAD_NO_HINTING))==0 )
+ if ( ( load->load_flags &
+ ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) == 0 )
{
MEM_Copy( load->exec->glyphIns, stream->cursor, n_ins );
error = TT_Set_CodeRange( load->exec, tt_coderange_glyph,
load->exec->glyphIns, n_ins );
- if (error) goto Fail;
+ if ( error )
+ goto Fail;
}
-#endif
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
stream->cursor += n_ins;
- /*********************************************************************/
- /* reading the point tags */
+ /* reading the point tags */
{
TT_Byte* flag = load->zone.tags;
TT_Byte* limit = flag + n_points;
TT_Byte c, count;
- for (; flag < limit; flag++)
+
+ for ( ; flag < limit; flag++ )
{
*flag = c = GET_Byte();
if ( c & 8 )
@@ -289,8 +320,7 @@
}
}
- /*********************************************************************/
- /* reading the X coordinates */
+ /* reading the X coordinates */
{
TT_Vector* vec = zone->org;
@@ -298,16 +328,19 @@
TT_Byte* flag = zone->tags;
TT_Pos x = 0;
+
for ( ; vec < limit; vec++, flag++ )
{
TT_Pos y = 0;
+
if ( *flag & 2 )
{
y = GET_Byte();
- if ((*flag & 16) == 0) y = -y;
+ if ( ( *flag & 16 ) == 0 )
+ y = -y;
}
- else if ((*flag & 16) == 0)
+ else if ( ( *flag & 16 ) == 0 )
y = GET_Short();
x += y;
@@ -315,8 +348,7 @@
}
}
- /*********************************************************************/
- /* reading the Y coordinates */
+ /* reading the Y coordinates */
{
TT_Vector* vec = zone->org;
@@ -324,16 +356,19 @@
TT_Byte* flag = zone->tags;
TT_Pos x = 0;
+
for ( ; vec < limit; vec++, flag++ )
{
TT_Pos y = 0;
+
if ( *flag & 4 )
{
y = GET_Byte();
- if ((*flag & 32) == 0) y = -y;
+ if ( ( *flag & 32 ) == 0 )
+ y = -y;
}
- else if ((*flag & 32) == 0)
+ else if ( ( *flag & 32 ) == 0 )
y = GET_Short();
x += y;
@@ -343,8 +378,7 @@
FORGET_Frame();
- /*********************************************************************/
- /* Add shadow points */
+ /* add shadow points */
/* Now add the two shadow points at n and n + 1. */
/* We need the left side bearing and advance width. */
@@ -353,6 +387,7 @@
TT_Vector* pp1;
TT_Vector* pp2;
+
/* pp1 = xMin - lsb */
pp1 = zone->org + n_points;
pp1->x = load->bbox.xMin - load->left_bearing;
@@ -370,6 +405,7 @@
zone->tags[n_points ] = 0;
zone->tags[n_points + 1] = 0;
}
+
/* Note that we return two more points that are not */
/* part of the glyph outline. */
@@ -377,10 +413,9 @@
zone->n_contours = n_contours;
n_points += 2;
- /*******************************************/
/* now eventually scale and hint the glyph */
- if (load->load_flags & FT_LOAD_NO_SCALE)
+ if ( load->load_flags & FT_LOAD_NO_SCALE )
{
/* no scaling, just copy the orig arrays into the cur ones */
org_to_cur( n_points, zone );
@@ -392,34 +427,38 @@
TT_Fixed x_scale = load->size->root.metrics.x_scale;
TT_Fixed y_scale = load->size->root.metrics.y_scale;
+
/* first scale the glyph points */
- for (; vec < limit; vec++)
+ for ( ; vec < limit; vec++ )
{
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
/* if hinting, round pp1, and shift the glyph accordingly */
- if ( !IS_HINTED(load->load_flags) )
+ if ( !IS_HINTED( load->load_flags ) )
{
org_to_cur( n_points, zone );
}
else
{
TT_Pos x = zone->org[n_points-2].x;
- x = ((x + 32) & -64) - x;
+
+
+ x = ( ( x + 32 ) & -64 ) - x;
translate_array( n_points, zone->org, x, 0 );
org_to_cur( n_points, zone );
- zone->cur[n_points-1].x = (zone->cur[n_points-1].x + 32) & -64;
+ zone->cur[n_points - 1].x = ( zone->cur[n_points - 1].x + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* now consider hinting */
if ( n_ins > 0 )
{
load->exec->is_composite = FALSE;
- load->exec->pedantic_hinting = (TT_Bool)(load->load_flags & FT_LOAD_PEDANTIC);
+ load->exec->pedantic_hinting = (TT_Bool)(load->load_flags &
+ FT_LOAD_PEDANTIC);
load->exec->pts = *zone;
load->exec->pts.n_points += 2;
@@ -427,7 +466,7 @@
if ( error && load->exec->pedantic_hinting )
return error;
}
-#endif
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
}
}
@@ -446,18 +485,14 @@
}
-
-
-
-
/*************************************************************************/
/* */
/* <Function> */
/* load_truetype_glyph */
/* */
/* <Description> */
- /* Loads a given truetype glyph. Handles composites and uses a */
- /* TT_Loader object.. */
+ /* Loads a given truetype glyph. Handles composites and uses a */
+ /* TT_Loader object. */
/* */
static
TT_Error load_truetype_glyph( TT_Loader* loader,
@@ -472,6 +507,7 @@
TT_Fixed x_scale, y_scale;
TT_ULong ins_offset;
+
/* check glyph index */
index = glyph_index;
if ( index >= (TT_UInt)face->root.num_glyphs )
@@ -485,9 +521,9 @@
num_points = 0;
ins_offset = 0;
- x_scale = 0x10000;
- y_scale = 0x10000;
- if ( (loader->load_flags & FT_LOAD_NO_SCALE)==0 )
+ x_scale = 0x10000L;
+ y_scale = 0x10000L;
+ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
x_scale = loader->size->root.metrics.x_scale;
y_scale = loader->size->root.metrics.y_scale;
@@ -498,6 +534,7 @@
TT_Short left_bearing;
TT_UShort advance_width;
+
Get_HMetrics( face, index,
(TT_Bool)!(loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH),
@@ -511,11 +548,11 @@
/* load glyph header */
offset = face->glyph_locations[index];
count = 0;
- if (index < (TT_UInt)face->num_locations-1)
- count = face->glyph_locations[index+1] - offset;
+ if ( index < (TT_UInt)face->num_locations - 1 )
+ count = face->glyph_locations[index + 1] - offset;
- if (count == 0)
+ if ( count == 0 )
{
/* as described by Frederic Loyer, these are spaces, and */
/* not the unknown glyph. */
@@ -527,11 +564,11 @@
loader->pp1.x = 0;
loader->pp2.x = loader->advance;
- if ( (loader->load_flags & FT_LOAD_NO_SCALE)==0 )
+ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if (loader->exec)
+ if ( loader->exec )
loader->exec->glyphSize = 0;
#endif
goto Load_End;
@@ -573,22 +610,23 @@
loader->pp2.x = loader->pp1.x + loader->advance;
loader->pp2.y = 0;
- if ((loader->load_flags & FT_LOAD_NO_SCALE)==0)
+ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+
+ /* if it is a simple glyph, load it */
- /**********************************************************************/
- /* if it is a simple glyph, load it */
- if (contours_count >= 0)
+ if ( contours_count >= 0 )
{
TT_UInt num_base_points;
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
error = Load_Simple( loader,
count,
@@ -609,6 +647,8 @@
num_base_points = loader->base.n_points;
{
TT_UInt k;
+
+
for ( k = 0; k < num_contours; k++ )
loader->zone.contours[k] += num_base_points;
}
@@ -622,42 +662,47 @@
loader->left_points -= num_points;
loader->left_contours -= num_contours;
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /************************************************************************/
- else /* otherwise, load a composite !! */
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+
+ /* otherwise, load a composite! */
+ else
{
/* for each subglyph, read composite header */
- TT_GlyphSlot glyph = loader->glyph;
+ TT_GlyphSlot glyph = loader->glyph;
FT_SubGlyph* subglyph = glyph->subglyphs + glyph->num_subglyphs;
- if (ACCESS_Frame(count)) goto Fail;
+ if ( ACCESS_Frame( count ) )
+ goto Fail;
num_subglyphs = 0;
do
{
TT_Fixed xx, xy, yy, yx;
- FT_UInt total_subglyphs;
-
- /* grow the 'glyph->subglyphs' table if necessary */
- total_subglyphs = glyph->num_subglyphs + num_subglyphs;
- if ( total_subglyphs >= glyph->max_subglyphs )
- {
- FT_UInt new_max = glyph->max_subglyphs;
- FT_Memory memory = loader->face->root.memory;
-
- while (new_max <= total_subglyphs)
- new_max += 4;
-
- if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
- new_max, FT_SubGlyph ) )
- goto Fail;
-
- glyph->max_subglyphs = new_max;
- subglyph = glyph->subglyphs + glyph->num_subglyphs + num_subglyphs;
- }
+ FT_UInt total_subglyphs;
+
+
+ /* grow the `glyph->subglyphs' table if necessary */
+ total_subglyphs = glyph->num_subglyphs + num_subglyphs;
+
+ if ( total_subglyphs >= glyph->max_subglyphs )
+ {
+ FT_UInt new_max = glyph->max_subglyphs;
+ FT_Memory memory = loader->face->root.memory;
+
+
+ while ( new_max <= total_subglyphs )
+ new_max += 4;
+
+ if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
+ new_max, FT_SubGlyph ) )
+ goto Fail;
+
+ glyph->max_subglyphs = new_max;
+ subglyph = glyph->subglyphs + glyph->num_subglyphs + num_subglyphs;
+ }
subglyph->arg1 = subglyph->arg2 = 0;
@@ -665,7 +710,7 @@
subglyph->index = GET_UShort();
/* read arguments */
- if (subglyph->flags & ARGS_ARE_WORDS)
+ if ( subglyph->flags & ARGS_ARE_WORDS )
{
subglyph->arg1 = GET_Short();
subglyph->arg2 = GET_Short();
@@ -677,20 +722,20 @@
}
/* read transform */
- xx = yy = 0x10000;
+ xx = yy = 0x10000L;
xy = yx = 0;
- if (subglyph->flags & WE_HAVE_A_SCALE)
+ if ( subglyph->flags & WE_HAVE_A_SCALE )
{
xx = (TT_Fixed)GET_Short() << 2;
yy = xx;
}
- else if (subglyph->flags & WE_HAVE_AN_XY_SCALE)
+ else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
{
xx = (TT_Fixed)GET_Short() << 2;
yy = (TT_Fixed)GET_Short() << 2;
}
- else if (subglyph->flags & WE_HAVE_A_2X2)
+ else if ( subglyph->flags & WE_HAVE_A_2X2 )
{
xx = (TT_Fixed)GET_Short() << 2;
xy = (TT_Fixed)GET_Short() << 2;
@@ -711,16 +756,18 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
/* we must undo the ACCESS_Frame in order to point to the */
- /* composite instructions, if we find some .. */
- /* we will process them later.. */
+ /* composite instructions, if we find some. */
+ /* we will process them later... */
+ /* */
ins_offset = FILE_Pos() + stream->cursor - stream->limit;
}
#endif
FORGET_Frame();
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
- /* "as is" in the glyph slot (the client application will be */
- /* responsible for interpreting this data..) */
+ /* `as is' in the glyph slot (the client application will be */
+ /* responsible for interpreting this data)... */
+ /* */
if ( loader->load_flags & FT_LOAD_NO_RECURSE )
{
/* set up remaining glyph fields */
@@ -730,9 +777,9 @@
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
/*********************************************************************/
/* Now, read each subglyph independently.. */
@@ -740,20 +787,23 @@
TT_Int n, num_base_points, num_new_points;
subglyph = glyph->subglyphs + glyph->num_subglyphs;
- glyph->num_subglyphs += num_subglyphs;
-
+ glyph->num_subglyphs += num_subglyphs;
+
+
for ( n = 0; n < num_subglyphs; n++, subglyph++ )
{
TT_Vector pp1, pp2;
TT_Pos x, y;
+
pp1 = loader->pp1;
pp2 = loader->pp2;
num_base_points = loader->base.n_points;
error = load_truetype_glyph( loader, subglyph->index );
- if (error) goto Fail;
+ if ( error )
+ goto Fail;
if ( subglyph->flags & USE_MY_METRICS )
{
@@ -771,7 +821,6 @@
num_new_points = num_points - num_base_points;
- /********************************************************/
/* now perform the transform required for this subglyph */
if ( subglyph->flags & ( WE_HAVE_A_SCALE |
@@ -782,10 +831,12 @@
TT_Vector* org = loader->zone.org;
TT_Vector* limit = cur + num_new_points;
+
for ( ; cur < limit; cur++, org++ )
{
TT_Pos nx, ny;
+
nx = FT_MulFix( cur->x, subglyph->transform.xx ) +
FT_MulFix( cur->y, subglyph->transform.yx );
@@ -808,11 +859,12 @@
/* apply offset */
- if ( !(subglyph->flags & ARGS_ARE_XY_VALUES) )
+ if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
{
TT_Int k = subglyph->arg1;
TT_UInt l = subglyph->arg2;
+
if ( k >= num_base_points ||
l >= (TT_UInt)num_new_points )
{
@@ -830,16 +882,16 @@
x = subglyph->arg1;
y = subglyph->arg2;
- if (!(loader->load_flags & FT_LOAD_NO_SCALE))
+ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
{
x = FT_MulFix( x, x_scale );
y = FT_MulFix( y, y_scale );
if ( subglyph->flags & ROUND_XY_TO_GRID )
- {
- x = (x + 32) & -64;
- y = (y + 32) & -64;
- }
+ {
+ x = ( x + 32 ) & -64;
+ y = ( y + 32 ) & -64;
+ }
}
}
@@ -847,16 +899,19 @@
cur_to_org( num_new_points, &loader->zone );
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
/* we have finished loading all sub-glyphs, now, look for */
- /* instructions for this composite !! */
+ /* instructions for this composite! */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
subglyph--;
- if (num_subglyphs > 0 && loader->exec && subglyph->flags & WE_HAVE_INSTR)
+ if ( num_subglyphs > 0 &&
+ loader->exec &&
+ subglyph->flags & WE_HAVE_INSTR )
{
TT_UShort n_ins;
TT_ExecContext exec = loader->exec;
@@ -864,9 +919,11 @@
FT_GlyphZone* pts;
TT_Vector* pp1;
+
/* read size of instructions */
if ( FILE_Seek( ins_offset ) ||
- READ_UShort(n_ins) ) goto Fail;
+ READ_UShort(n_ins) )
+ goto Fail;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
/* check it */
@@ -877,9 +934,11 @@
return TT_Err_Too_Many_Ins;
}
- if (exec)
+ if ( exec )
{
+ /* XXX */
}
+
/* read the instructions */
if ( FILE_Read( exec->glyphIns, n_ins ) )
goto Fail;
@@ -888,11 +947,12 @@
tt_coderange_glyph,
exec->glyphIns,
n_ins );
- if ( error ) goto Fail;
+ if ( error )
+ goto Fail;
/* prepare the execution context */
- exec->pts = loader->base;
- pts = &exec->pts;
+ exec->pts = loader->base;
+ pts = &exec->pts;
pts->n_points = num_points + 2;
pts->n_contours = num_contours;
@@ -906,14 +966,16 @@
pts->tags[num_points + 2] = 0;
/* if hinting, round the phantom points */
- if ( IS_HINTED(loader->load_flags) )
+ if ( IS_HINTED( loader->load_flags ) )
{
- pp1[0].x = ((loader->pp1.x + 32) & -64);
- pp1[1].x = ((loader->pp2.x + 32) & -64);
+ pp1[0].x = ( ( loader->pp1.x + 32 ) & -64 );
+ pp1[1].x = ( ( loader->pp2.x + 32 ) & -64 );
}
{
TT_UInt k;
+
+
for ( k = 0; k < n_points; k++ )
pts->tags[k] &= FT_Curve_Tag_On;
}
@@ -936,15 +998,15 @@
loader->pp1 = pp1[0];
loader->pp2 = pp1[1];
}
-#endif
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
}
- /* end of composite loading */
+ /* end of composite loading */
}
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
+ /***********************************************************************/
Load_End:
error = TT_Err_Ok;
@@ -954,12 +1016,9 @@
}
-
-
-
static
- void compute_glyph_metrics( TT_Loader* loader,
- TT_UInt glyph_index )
+ void compute_glyph_metrics( TT_Loader* loader,
+ TT_UInt glyph_index )
{
TT_UInt num_points = loader->base.n_points;
TT_UInt num_contours = loader->base.n_contours;
@@ -969,18 +1028,19 @@
TT_GlyphSlot glyph = loader->glyph;
TT_Size size = loader->size;
+
/* when a simple glyph was loaded, the value of */
- /* "base.n_points" and "base.n_contours" is 0, we must */
- /* take those in the "zone" instead.. */
+ /* `base.n_points' and `base.n_contours' is 0, we will */
+ /* take those in the `zone' instead. */
if ( num_points == 0 && num_contours == 0 )
{
num_points = loader->zone.n_points;
num_contours = loader->zone.n_contours;
}
- x_scale = 0x10000;
- y_scale = 0x10000;
- if ( (loader->load_flags & FT_LOAD_NO_SCALE) == 0)
+ x_scale = 0x10000L;
+ y_scale = 0x10000L;
+ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
x_scale = size->root.metrics.x_scale;
y_scale = size->root.metrics.y_scale;
@@ -989,6 +1049,8 @@
if ( glyph->format != ft_glyph_format_composite )
{
TT_UInt u;
+
+
for ( u = 0; u < num_points + 2; u++ )
{
glyph->outline.points[u] = loader->base.cur[u];
@@ -1003,56 +1065,57 @@
glyph->outline.n_contours = num_contours;
/* translate array so that (0,0) is the glyph's origin */
- translate_array( (TT_UShort)(num_points + 2),
+ translate_array( (TT_UShort)( num_points + 2 ),
glyph->outline.points,
-loader->pp1.x,
0 );
FT_Outline_Get_CBox( &glyph->outline, &bbox );
- if ( IS_HINTED(loader->load_flags) )
+ if ( IS_HINTED( loader->load_flags ) )
{
/* grid-fit the bounding box */
bbox.xMin &= -64;
bbox.yMin &= -64;
- bbox.xMax = (bbox.xMax + 63) & -64;
- bbox.yMax = (bbox.yMax + 63) & -64;
+ bbox.xMax = ( bbox.xMax + 63 ) & -64;
+ bbox.yMax = ( bbox.yMax + 63 ) & -64;
}
}
else
bbox = loader->bbox;
- /* get the device-independent scaled horizontal metrics */
- /* take care of fixed-pitch fonts... */
+ /* get the device-independent scaled horizontal metrics; */
+ /* take care of fixed-pitch fonts... */
{
TT_Pos left_bearing;
TT_Pos advance;
-
+
TT_Pos lsb2, adv2;
+
left_bearing = loader->left_bearing;
advance = loader->advance;
- /* the flag FT_LOAD_NO_ADVANCE_CHECK was introduced to */
- /* correctly support DynaLab fonts, who have an incorrect */
- /* "advance_Width_Max" field !! It is used, to my knowledge */
- /* exclusively in the X-TrueType font server.. */
- /* */
- if ( face->postscript.isFixedPitch &&
- (loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH) == 0 )
+ /* the flag FT_LOAD_NO_ADVANCE_CHECK was introduced to */
+ /* correctly support DynaLab fonts, which have an incorrect */
+ /* `advance_Width_Max' field! It is used, to my knowledge, */
+ /* exclusively in the X-TrueType font server. */
+ /* */
+ if ( face->postscript.isFixedPitch &&
+ ( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
advance = face->horizontal.advance_Width_Max;
lsb2 = left_bearing;
adv2 = advance;
-
+
/* if necessary, scale the horizontal left bearing and advance */
/* to get their values in 16.16 format.. */
- if ( !(loader->load_flags & FT_LOAD_NO_SCALE) &&
- loader->load_flags & FT_LOAD_LINEAR )
+ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) &&
+ loader->load_flags & FT_LOAD_LINEAR )
{
FT_Pos em_size = face->root.units_per_EM;
FT_Pos pixel_size = (FT_Pos)face->root.size->metrics.x_ppem << 16;
-
+
lsb2 = FT_MulDiv( lsb2, pixel_size, em_size );
adv2 = FT_MulDiv( adv2, pixel_size, em_size );
}
@@ -1092,40 +1155,40 @@
}
else
{
- /* Make up the distances from the horizontal header.. */
-
- /* NOTE: The OS/2 values are the only `portable' ones, */
- /* which is why we use them, when there is an */
- /* OS/2 table in the font. Otherwise, we use the */
- /* values defined in the horizontal header.. */
- /* */
- /* NOTE2: The sTypoDescender is negative, which is why */
- /* we compute the baseline-to-baseline distance */
- /* here with: */
- /* ascender - descender + linegap */
- /* */
+ /* Make up the distances from the horizontal header. */
+
+ /* NOTE: The OS/2 values are the only `portable' ones, */
+ /* which is why we use them, if there is an OS/2 */
+ /* table in the font. Otherwise, we use the */
+ /* values defined in the horizontal header. */
+ /* */
+ /* NOTE2: The sTypoDescender is negative, which is why */
+ /* we compute the baseline-to-baseline distance */
+ /* here with: */
+ /* ascender - descender + linegap */
+ /* */
if ( face->os2.version != 0xFFFF )
{
top_bearing = face->os2.sTypoLineGap / 2;
- advance_height = (TT_UShort)(face->os2.sTypoAscender -
- face->os2.sTypoDescender +
- face->os2.sTypoLineGap);
+ advance_height = (TT_UShort)( face->os2.sTypoAscender -
+ face->os2.sTypoDescender +
+ face->os2.sTypoLineGap );
}
else
{
top_bearing = face->horizontal.Line_Gap / 2;
- advance_height = (TT_UShort)(face->horizontal.Ascender +
- face->horizontal.Descender +
- face->horizontal.Line_Gap);
+ advance_height = (TT_UShort)( face->horizontal.Ascender +
+ face->horizontal.Descender +
+ face->horizontal.Line_Gap );
}
}
- /* We must adjust the top_bearing value from the bounding box given
- in the glyph header to te bounding box calculated with
- TT_Get_Outline_BBox() */
+ /* We must adjust the top_bearing value from the bounding box given */
+ /* in the glyph header to te bounding box calculated with */
+ /* TT_Get_Outline_BBox(). */
/* scale the metrics */
- if ( !(loader->load_flags & FT_LOAD_NO_SCALE) )
+ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
{
Top = FT_MulFix( top_bearing, y_scale );
top = FT_MulFix( top_bearing + loader->bbox.yMax, y_scale )
@@ -1141,20 +1204,22 @@
/* compute metrics2 fields */
{
- FT_Pos vtb2 = top_bearing;
- FT_Pos adv2 = advance_height;
-
+ TT_Pos vtb2 = top_bearing;
+ TT_Pos adv2 = advance_height;
+
+
/* scale to 16.16 format if required */
- if ( !(loader->load_flags & FT_LOAD_NO_SCALE) &&
- loader->load_flags & FT_LOAD_LINEAR )
- {
- FT_Pos em_size = face->root.units_per_EM;
- FT_Pos pixel_size = face->root.size->metrics.y_ppem;
-
+ if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) &&
+ loader->load_flags & FT_LOAD_LINEAR )
+ {
+ TT_Pos em_size = face->root.units_per_EM;
+ TT_Pos pixel_size = face->root.size->metrics.y_ppem;
+
+
vtb2 = FT_MulDiv( vtb2, pixel_size, em_size );
adv2 = FT_MulDiv( adv2, pixel_size, em_size );
}
-
+
glyph->metrics2.vertBearingY = vtb2;
glyph->metrics2.vertAdvance = adv2;
}
@@ -1165,11 +1230,11 @@
left = ( bbox.xMin - bbox.xMax ) / 2;
/* grid-fit them if necessary */
- if ( IS_HINTED(loader->load_flags) )
+ if ( IS_HINTED( loader->load_flags ) )
{
left &= -64;
- top = (top + 63) & -64;
- advance = (advance + 32) & -64;
+ top = ( top + 63 ) & -64;
+ advance = ( advance + 32 ) & -64;
}
glyph->metrics.vertBearingX = left;
@@ -1179,10 +1244,10 @@
/* Adjust advance width to the value contained in the hdmx table. */
if ( !face->postscript.isFixedPitch && size &&
- IS_HINTED(loader->load_flags) )
+ IS_HINTED( loader->load_flags ) )
{
TT_Byte* widths = Get_Advance_Widths( face,
- size->root.metrics.x_ppem );
+ size->root.metrics.x_ppem );
if ( widths )
glyph->metrics.horiAdvance = widths[glyph_index] << 6;
}
@@ -1190,7 +1255,7 @@
/* drop-out mode is irrelevant, we always use mode 2 */
#if 0
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- if (loader->exec)
+ if ( loader->exec )
glyph->outline.dropout_mode = (TT_Char)loader->exec->GS.scan_type;
#else
glyph->outline.dropout_mode = 2;
@@ -1204,16 +1269,33 @@
}
-
-
-
-
-
-
-
-
-
-
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Load_Glyph */
+ /* */
+ /* <Description> */
+ /* A function used to load a single glyph within a given glyph slot, */
+ /* for a given size. */
+ /* */
+ /* <Input> */
+ /* glyph :: A handle to a target slot object where the glyph */
+ /* will be loaded. */
+ /* */
+ /* size :: A handle to the source face size at which the glyph */
+ /* must be scaled/loaded. */
+ /* */
+ /* glyph_index :: The index of the glyph in the font file. */
+ /* */
+ /* load_flags :: A flag indicating what to load for this glyph. The */
+ /* FT_LOAD_XXX constants can be used to control the */
+ /* glyph loading process (e.g., whether the outline */
+ /* should be scaled, whether to load bitmaps or not, */
+ /* whether to hint the outline, etc). */
+ /* */
+ /* <Return> */
+ /* TrueType error code. 0 means success. */
+ /* */
LOCAL_FUNC
TT_Error TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph,
@@ -1228,14 +1310,15 @@
TT_Loader loader;
FT_GlyphZone* zone;
+
face = (TT_Face)glyph->face;
sfnt = (SFNT_Interface*)face->sfnt;
stream = face->root.stream;
memory = face->root.memory;
error = 0;
- if ( !size || (load_flags & FT_LOAD_NO_SCALE) ||
- (load_flags & FT_LOAD_NO_RECURSE ))
+ if ( !size || ( load_flags & FT_LOAD_NO_SCALE ) ||
+ ( load_flags & FT_LOAD_NO_RECURSE ) )
{
size = NULL;
load_flags |= FT_LOAD_NO_SCALE |
@@ -1246,12 +1329,15 @@
glyph->num_subglyphs = 0;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
- /*********************************************************************/
- /* Try to load embedded bitmap if any */
- if ( size && (load_flags & FT_LOAD_NO_BITMAP) == 0 && sfnt->load_sbits )
+
+ /* try to load embedded bitmap if any */
+ if ( size &&
+ ( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
+ sfnt->load_sbits )
{
TT_SBit_Metrics metrics;
+
error = sfnt->load_sbit_image( face,
size->root.metrics.x_ppem,
size->root.metrics.y_ppem,
@@ -1280,31 +1366,33 @@
return error;
}
}
+
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
if ( load_flags & FT_LOAD_NO_OUTLINE )
return ( error ? error : TT_Err_Unavailable_Bitmap );
- /* seek to the beginning of the glyph table. For Type 43 fonts */
- /* the table might be accessed from a Postscript stream or something */
- /* else... */
+ /* seek to the beginning of the glyph table. For Type 43 fonts */
+ /* the table might be accessed from a Postscript stream or something */
+ /* else... */
+
error = face->goto_table( face, TTAG_glyf, stream, 0 );
- if (error)
+ if ( error )
{
- FT_ERROR(( "TT.GLoad: could not access glyph table\n" ));
+ FT_ERROR(( "TT_Load_Glyph: Could not access glyph table\n" ));
goto Exit;
}
- MEM_Set( &loader, 0, sizeof(loader) );
+ MEM_Set( &loader, 0, sizeof ( loader ) );
/* update the glyph zone bounds */
- zone = &((TT_Driver)face->root.driver)->zone;
- error = FT_Update_GlyphZone( zone,
- face->root.max_points,
- face->root.max_contours );
- if (error)
+ zone = &((TT_Driver)face->root.driver)->zone;
+ error = FT_Update_GlyphZone( zone,
+ face->root.max_points,
+ face->root.max_contours );
+ if ( error )
{
- FT_ERROR(( "TT.GLoad: could not update loader glyph zone\n" ));
+ FT_ERROR(( "TT_Load_Glyph: Could not update loader glyph zone\n" ));
goto Exit;
}
loader.base = *zone;
@@ -1313,10 +1401,11 @@
loader.zone.n_contours = 0;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
if ( size )
{
/* query new execution context */
- loader.exec = size->debug ? size->context : TT_New_Context(face);
+ loader.exec = size->debug ? size->context : TT_New_Context( face );
if ( !loader.exec )
return TT_Err_Could_Not_Find_Context;
@@ -1326,16 +1415,17 @@
if ( size->GS.instruct_control & 2 )
loader.exec->GS = tt_default_graphics_state;
}
+
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
- /* clear all outline flags, except the "owner" one */
+ /* clear all outline flags, except the `owner' one */
glyph->outline.flags &= ft_outline_owner;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->outline.flags |= ft_outline_high_precision;
- /************************************************************************/
- /* let's initialise the rest of our loader now */
+ /* let's initialize the rest of our loader now */
+
loader.left_points = face->root.max_points;
loader.left_contours = face->root.max_contours;
loader.load_flags = load_flags;
@@ -1348,17 +1438,19 @@
loader.glyf_offset = FILE_Pos();
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
- /* when the cvt program has disabled hinting, the argument */
- /* is ignored. */
- if ( size && (size->GS.instruct_control & 1) )
+
+ /* if the cvt program has disabled hinting, the argument */
+ /* is ignored. */
+ if ( size && ( size->GS.instruct_control & 1 ) )
loader.load_flags |= FT_LOAD_NO_HINTING;
-#endif
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/* Main loading loop */
glyph->format = ft_glyph_format_outline;
- glyph->num_subglyphs = 0;
+ glyph->num_subglyphs = 0;
error = load_truetype_glyph( &loader, glyph_index );
- if (!error)
+ if ( !error )
compute_glyph_metrics( &loader, glyph_index );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -1371,5 +1463,4 @@
}
-
/* END */
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index 93a8d23..47cc2fb 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,11 +4,11 @@
/* */
/* TrueType Glyph Loader (specification). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -29,7 +29,7 @@
extern "C" {
#endif
- typedef struct TT_Loader_
+ typedef struct TT_Loader_
{
TT_Face face;
TT_Size size;
@@ -64,72 +64,12 @@
} TT_Loader;
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Get_Metrics */
- /* */
- /* <Description> */
- /* Returns the horizontal or vertical metrics in font units for a */
- /* given glyph. The metrics are the left side bearing (resp. top */
- /* side bearing) and advance width (resp. advance height). */
- /* */
- /* <Input> */
- /* header :: A pointer to either the horizontal or vertical metrics */
- /* structure. */
- /* */
- /* index :: The glyph index. */
- /* */
- /* <Output> */
- /* bearing :: The bearing, either left side or top side. */
- /* */
- /* advance :: The advance width resp. advance height. */
- /* */
- /* <Note> */
- /* This function will much probably move to another component in the */
- /* near future, but I haven't decided which yet. */
- /* */
LOCAL_DEF
void TT_Get_Metrics( TT_HoriHeader* header,
TT_UInt index,
TT_Short* bearing,
TT_UShort* advance );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Glyph */
- /* */
- /* <Description> */
- /* A function used to load a single glyph within a given glyph slot, */
- /* for a given size. */
- /* */
- /* <Input> */
- /* glyph :: A handle to a target slot object where the glyph */
- /* will be loaded. */
- /* */
- /* size :: A handle to the source face size at which the glyph */
- /* must be scaled/loaded. */
- /* */
- /* glyph_index :: The index of the glyph in the font file. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* FT_LOAD_XXX constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* <Output> */
- /* result :: A set of bit flags indicating the type of data that */
- /* was loaded in the glyph slot (outline or bitmap, */
- /* etc). */
- /* */
- /* You can set this field to 0 if you don't want this */
- /* information. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph,
@@ -140,7 +80,6 @@
}
#endif
-
#endif /* TTGLOAD_H */
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 9e53b5d..76780da 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -2,13 +2,13 @@
/* */
/* ttinterp.c */
/* */
-/* TrueType bytecode intepreter (body). */
+/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -24,6 +24,7 @@
#include <freetype/internal/tterrors.h>
#include <ttinterp.h>
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -32,27 +33,33 @@
#define TT_INT64 FT_Int64
-/* required by the tracing mode */
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttinterp
+#define FT_COMPONENT trace_ttinterp
#undef NO_APPLE_PATENT
-#define APPLE_THRESHOLD 0x4000000
+#define APPLE_THRESHOLD 0x4000000L
/*************************************************************************/
/* */
- /* In order to detect infinite loops in the code, we set-up a counter */
- /* within the run loop. a single stroke of interpretation is now limited */
- /* to a maximum number of opcodes defined below. */
+ /* In order to detect infinite loops in the code, we set up a counter */
+ /* within the run loop. A single stroke of interpretation is now */
+ /* limitet to a maximal number of opcodes defined below. */
/* */
-#define MAX_RUNNABLE_OPCODES 1000000
+#define MAX_RUNNABLE_OPCODES 1000000L
/*************************************************************************/
/* */
/* There are two kinds of implementations: */
/* */
- /* a. static implementation: */
+ /* a. static implementation */
/* */
/* The current execution context is a static variable, which fields */
/* are accessed directly by the interpreter during execution. The */
@@ -60,7 +67,7 @@
/* */
/* This version is non-reentrant, of course. */
/* */
- /* b. indirect implementation: */
+ /* b. indirect implementation */
/* */
/* The current execution context is passed to _each_ function as its */
/* first argument, and each field is thus accessed indirectly. */
@@ -85,13 +92,13 @@
/*************************************************************************/
-#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */
+#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */
-#define CUR (*exc) /* see ttobjs.h */
+#define CUR (*exc) /* see ttobjs.h */
-#else /* static implementation */
+#else /* static implementation */
-#define CUR cur
+#define CUR cur
static
TT_ExecContextRec cur; /* static exec. context variable */
@@ -105,11 +112,9 @@
/*************************************************************************/
/* */
- /* Most of FreeType builds don't use engine compensations. We thus */
- /* introduce a macro, FT_CONFIG_OPTION_INTERPRETER_QUICK, which controls */
- /* the use of these values. */
+ /* The instruction argument stack. */
/* */
-#define INS_ARG EXEC_OP_ TT_Long* args /* see ttobjs.h for EXEC_OP_ */
+#define INS_ARG EXEC_OP_ TT_Long* args /* see ttobjs.h for EXEC_OP_ */
/*************************************************************************/
@@ -117,7 +122,7 @@
/* This macro is used whenever `exec' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */
/* */
-#define UNUSED_EXEC UNUSED(CUR)
+#define UNUSED_EXEC UNUSED( CUR )
/*************************************************************************/
@@ -125,13 +130,13 @@
/* This macro is used whenever `args' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */
/* */
-#define UNUSED_ARG UNUSED_EXEC; UNUSED(args);
+#define UNUSED_ARG UNUSED_EXEC; UNUSED( args )
/*************************************************************************/
/* */
/* The following macros hide the use of EXEC_ARG and EXEC_ARG_ to */
- /* increase readabiltyof the code. */
+ /* increase readabilty of the code. */
/* */
/*************************************************************************/
@@ -206,7 +211,6 @@
Move_Zp2_Point( EXEC_ARG_ a, b, c, t )
-
/*************************************************************************/
/* */
/* Instruction dispatch function, as used by the interpreter. */
@@ -218,14 +222,14 @@
/* */
/* A simple bounds-checking macro. */
/* */
-#define BOUNDS( x, n ) ((TT_UInt)(x) >= (TT_UInt)(n))
+#define BOUNDS( x, n ) ( (TT_UInt)(x) >= (TT_UInt)(n) )
-#undef SUCCESS
-#define SUCCESS 0
+#undef SUCCESS
+#define SUCCESS 0
-#undef FAILURE
-#define FAILURE 1
+#undef FAILURE
+#define FAILURE 1
/*************************************************************************/
@@ -246,7 +250,8 @@
/* */
/* <Input> */
/* range :: The new execution code range. */
- /* IP :: The new IP in the new code range. */
+ /* */
+ /* IP :: The new IP in the new code range. */
/* */
/* <InOut> */
/* exec :: The target execution context. */
@@ -270,7 +275,7 @@
/* NOTE: Because the last instruction of a program may be a CALL */
/* which will return to the first byte *after* the code */
- /* range, we test for IP <= Size, instead of IP < Size. */
+ /* range, we test for IP <= Size instead of IP < Size. */
/* */
FT_Assert( (TT_ULong)IP <= coderange->size );
@@ -293,7 +298,9 @@
/* */
/* <Input> */
/* range :: The code range index. */
+ /* */
/* base :: The new code base. */
+ /* */
/* length :: The range size in bytes. */
/* */
/* <InOut> */
@@ -367,7 +374,8 @@
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
- /* system :: A handle to the parent system object. */
+ /* */
+ /* memory :: A handle to the parent memory object. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
@@ -467,7 +475,7 @@
Fail_Memory:
FT_ERROR(( "TT.Context_Create: not enough memory for 0x%08lx\n",
- (long)exec ));
+ (long)exec ));
TT_Destroy_Context( exec, memory );
return error;
@@ -483,6 +491,8 @@
/* Checks the size of a buffer and reallocates it if necessary. */
/* */
/* <Input> */
+ /* memory :: A handle to the parent memory object. */
+ /* */
/* multiplier :: The size in bytes of each element in the buffer. */
/* */
/* new_max :: The new capacity (size) of the buffer. */
@@ -529,6 +539,7 @@
/* */
/* <Input> */
/* face :: A handle to the source face object. */
+ /* */
/* size :: A handle to the source size object. */
/* */
/* <InOut> */
@@ -550,6 +561,7 @@
TT_MaxProfile* maxp;
TT_Error error;
+
exec->face = face;
maxp = &face->max_profile;
exec->size = size;
@@ -633,8 +645,8 @@
/* <Input> */
/* exec :: A handle to the source execution context. */
/* */
- /* <Output> */
- /* ins :: A handle to the target size object. */
+ /* <InOut> */
+ /* size :: A handle to the target size object. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
@@ -648,6 +660,7 @@
{
TT_Int i;
+
/* XXXX: Will probably disappear soon with all the code range */
/* management, which is now rather obsolete. */
/* */
@@ -677,6 +690,8 @@
/* variables and returns immediately, otherwise TT_RunIns() */
/* is called. */
/* */
+ /* This is commented out currently. */
+ /* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* */
@@ -692,7 +707,8 @@
{
TT_Error error;
- if ( (error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ))
+
+ if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) )
!= TT_Err_Ok )
return error;
@@ -719,7 +735,8 @@
exec->callTop = 0;
#if 1
- UNUSED(debug);
+ UNUSED( debug );
+
return exec->face->interpreter( exec );
#else
if ( !debug )
@@ -762,14 +779,20 @@
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
- FT_EXPORT_FUNC(TT_ExecContext) TT_New_Context( TT_Face face )
+ FT_EXPORT_FUNC( TT_ExecContext ) TT_New_Context( TT_Face face )
{
- TT_Driver driver = (TT_Driver)face->root.driver;
+ TT_Driver driver;
TT_ExecContext exec;
- FT_Memory memory = driver->root.memory;
+ FT_Memory memory;
+
+
+ if ( !face )
+ return 0;
+ driver = (TT_Driver)face->root.driver;
- exec = driver->context;
+ memory = driver->root.memory;
+ exec = driver->context;
if ( !driver->context )
{
@@ -828,9 +851,11 @@
#ifdef FT_CONFIG_OPTION_OLD_CALCS
- static TT_F26Dot6 Norm( TT_F26Dot6 X, TT_F26Dot6 Y )
+ static TT_F26Dot6 Norm( TT_F26Dot6 X,
+ TT_F26Dot6 Y )
{
- FT_Int64 T1, T2;
+ FT_Int64 T1, T2;
+
MUL_64( X, X, T1 );
MUL_64( Y, Y, T2 );
@@ -839,7 +864,8 @@
return (TT_F26Dot6)SQRT_64( T1 );
}
-#endif
+
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
/*************************************************************************/
@@ -866,7 +892,7 @@
#undef PACK
-#define PACK( x, y ) ((x << 4) | y)
+#define PACK( x, y ) ( ( x << 4 ) | y )
static
@@ -1181,7 +1207,7 @@
#undef NULL_Vector
-#define NULL_Vector (TT_Vector*)&Null_Vector
+#define NULL_Vector (TT_Vector*)&Null_Vector
/*************************************************************************/
@@ -1218,8 +1244,8 @@
#else
x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x8000 );
y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x8000 );
- CUR.tt_metrics.ratio = FT_Sqrt32( x*x+y*y ) << 1;
-#endif
+ CUR.tt_metrics.ratio = FT_Sqrt32( x * x + y * y ) << 1;
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
}
return CUR.tt_metrics.ratio;
@@ -1304,7 +1330,8 @@
{
/* Reading a byte stream so there is no endianess (DaveP) */
CUR.IP += 2;
- return (TT_Short)((CUR.code[CUR.IP - 2] << 8) + CUR.code[CUR.IP - 1]);
+ return (TT_Short)( ( CUR.code[CUR.IP - 2] << 8 ) +
+ CUR.code[CUR.IP - 1] );
}
@@ -1375,6 +1402,7 @@
/* */
/* <Input> */
/* point :: The index of the point to move. */
+ /* */
/* distance :: The distance to apply. */
/* */
/* <InOut> */
@@ -1393,7 +1421,7 @@
if ( v != 0 )
{
#ifdef NO_APPLE_PATENT
- if ( ABS(CUR.F_dot_P) > APPLE_THRESHOLD )
+ if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].x += distance;
#else
zone->cur[point].x += TT_MULDIV( distance,
@@ -1408,7 +1436,7 @@
if ( v != 0 )
{
#ifdef NO_APPLE_PATENT
- if ( ABS(CUR.F_dot_P) > APPLE_THRESHOLD )
+ if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].y += distance;
#else
zone->cur[point].y += TT_MULDIV( distance,
@@ -1425,7 +1453,7 @@
/* Special versions of Direct_Move() */
/* */
/* The following versions are used whenever both vectors are both */
- /* along one of the coordinate unit vectors, i.e. in 90% cases. */
+ /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */
/* */
/*************************************************************************/
@@ -1463,6 +1491,7 @@
/* */
/* <Input> */
/* distance :: The distance (not) to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1480,9 +1509,9 @@
{
TT_F26Dot6 val;
-
UNUSED_EXEC;
+
if ( distance >= 0 )
{
val = distance + compensation;
@@ -1508,6 +1537,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1519,9 +1549,9 @@
{
TT_F26Dot6 val;
-
UNUSED_EXEC;
+
if ( distance >= 0 )
{
val = distance + compensation + 32;
@@ -1532,10 +1562,11 @@
}
else
{
- val = -( (compensation - distance + 32) & (-64) );
+ val = -( ( compensation - distance + 32 ) & -64 );
if ( val > 0 )
val = 0;
}
+
return val;
}
@@ -1550,6 +1581,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1561,21 +1593,22 @@
{
TT_F26Dot6 val;
+ UNUSED_EXEC;
- UNUSED_EXEC;
if ( distance >= 0 )
{
- val = ((distance + compensation) & (-64)) + 32;
+ val = ( ( distance + compensation ) & -64 ) + 32;
if ( val < 0 )
val = 0;
}
else
{
- val = -( ((compensation - distance) & (-64)) + 32 );
+ val = -( ( (compensation - distance) & -64 ) + 32 );
if ( val > 0 )
val = 0;
}
+
return val;
}
@@ -1590,6 +1623,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1601,9 +1635,9 @@
{
TT_F26Dot6 val;
-
UNUSED_EXEC;
+
if ( distance >= 0 )
{
val = distance + compensation;
@@ -1614,10 +1648,11 @@
}
else
{
- val = -( (compensation - distance) & (-64) );
+ val = -( ( compensation - distance ) & -64 );
if ( val > 0 )
val = 0;
}
+
return val;
}
@@ -1632,6 +1667,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1656,10 +1692,11 @@
}
else
{
- val = -( (compensation - distance + 63) & (-64) );
+ val = -( ( compensation - distance + 63 ) & -64 );
if ( val > 0 )
val = 0;
}
+
return val;
}
@@ -1674,6 +1711,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1687,6 +1725,7 @@
UNUSED_EXEC;
+
if ( distance >= 0 )
{
val = distance + compensation + 16;
@@ -1697,10 +1736,11 @@
}
else
{
- val = -( (compensation - distance + 16) & (-32) );
+ val = -( ( compensation - distance + 16 ) & -32 );
if ( val > 0 )
val = 0;
}
+
return val;
}
@@ -1715,6 +1755,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1735,20 +1776,21 @@
if ( distance >= 0 )
{
- val = (distance - CUR.phase + CUR.threshold + compensation) &
- (-CUR.period);
+ val = ( distance - CUR.phase + CUR.threshold + compensation ) &
+ -CUR.period;
if ( val < 0 )
val = 0;
val += CUR.phase;
}
else
{
- val = -( (CUR.threshold - CUR.phase - distance + compensation) &
- (-CUR.period) );
+ val = -( ( CUR.threshold - CUR.phase - distance + compensation ) &
+ -CUR.period );
if ( val > 0 )
val = 0;
val -= CUR.phase;
}
+
return val;
}
@@ -1763,6 +1805,7 @@
/* */
/* <Input> */
/* distance :: The distance to round. */
+ /* */
/* compensation :: The engine compensation. */
/* */
/* <Return> */
@@ -1781,7 +1824,7 @@
if ( distance >= 0 )
{
- val = ( (distance - CUR.phase + CUR.threshold + compensation) /
+ val = ( ( distance - CUR.phase + CUR.threshold + compensation ) /
CUR.period ) * CUR.period;
if ( val < 0 )
val = 0;
@@ -1789,7 +1832,7 @@
}
else
{
- val = -( ( (CUR.threshold - CUR.phase - distance + compensation) /
+ val = -( ( ( CUR.threshold - CUR.phase - distance + compensation ) /
CUR.period ) * CUR.period );
if ( val > 0 )
val = 0;
@@ -1867,7 +1910,7 @@
void SetSuperRound( EXEC_OP_ TT_F26Dot6 GridPeriod,
TT_Long selector )
{
- switch ( (TT_Int)(selector & 0xC0) )
+ switch ( (TT_Int)( selector & 0xC0 ) )
{
case 0:
CUR.period = GridPeriod / 2;
@@ -1888,7 +1931,7 @@
break;
}
- switch ( (TT_Int)(selector & 0x30) )
+ switch ( (TT_Int)( selector & 0x30 ) )
{
case 0:
CUR.phase = 0;
@@ -1910,7 +1953,7 @@
if ( (selector & 0x0F) == 0 )
CUR.threshold = CUR.period - 1;
else
- CUR.threshold = ( (TT_Int)(selector & 0x0F) - 4 ) * CUR.period / 8;
+ CUR.threshold = ( (TT_Int)( selector & 0x0F ) - 4 ) * CUR.period / 8;
CUR.period /= 256;
CUR.phase /= 256;
@@ -2015,7 +2058,7 @@
{
UNUSED_EXEC;
- return (v1->x - v2->x);
+ return ( v1->x - v2->x );
}
@@ -2041,7 +2084,7 @@
{
UNUSED_EXEC;
- return (v1->y - v2->y);
+ return ( v1->y - v2->y );
}
@@ -2145,15 +2188,18 @@
/* */
#ifdef FT_CONFIG_OPTION_OLD_CALCS
- static TT_Bool Normalize( EXEC_OP_ TT_F26Dot6 Vx,
- TT_F26Dot6 Vy,
- TT_UnitVector* R )
+
+ static
+ TT_Bool Normalize( EXEC_OP_ TT_F26Dot6 Vx,
+ TT_F26Dot6 Vy,
+ TT_UnitVector* R )
{
TT_F26Dot6 W;
TT_Bool S1, S2;
UNUSED_EXEC;
+
if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
{
Vx *= 0x100;
@@ -2163,8 +2209,8 @@
if ( W == 0 )
{
- /* XXX : UNDOCUMENTED! It seems that it's possible to try */
- /* to normalize the vector (0,0). Return immediately */
+ /* XXX: UNDOCUMENTED! It seems that it's possible to try */
+ /* to normalize the vector (0,0). Return immediately. */
return SUCCESS;
}
@@ -2202,7 +2248,7 @@
while ( W < 0x1000000L )
{
- /* We need to increase W, by a minimal amount */
+ /* We need to increase W by a minimal amount */
if ( Vx < Vy )
Vx++;
else
@@ -2213,7 +2259,7 @@
while ( W >= 0x1004000L )
{
- /* We need to decrease W, by a minimal amount */
+ /* We need to decrease W by a minimal amount */
if ( Vx < Vy )
Vx--;
else
@@ -2236,7 +2282,9 @@
return SUCCESS;
}
+
#else
+
static
TT_Bool Normalize( EXEC_OP_ TT_F26Dot6 Vx,
TT_F26Dot6 Vy,
@@ -2246,10 +2294,11 @@
TT_Int shift;
TT_ULong H, L, L2, hi, lo, med;
- u = ABS(Vx);
- v = ABS(Vy);
- if (u < v)
+ u = ABS( Vx );
+ v = ABS( Vy );
+
+ if ( u < v )
{
d = u;
u = v;
@@ -2259,42 +2308,46 @@
R->x = 0;
R->y = 0;
- /* check that we're not trying to normalise zero !! */
- if (u==0) return SUCCESS;
+ /* check that we are not trying to normalise zero! */
+ if ( u == 0 )
+ return SUCCESS;
- /* compute (u*u+v*v) on 64 bits with two 32-bit registers [H:L] */
+ /* compute (u*u + v*v) on 64 bits with two 32-bit registers [H:L] */
hi = (TT_ULong)u >> 16;
lo = (TT_ULong)u & 0xFFFF;
- med = hi*lo;
+ med = hi * lo;
- H = hi*hi + (med >> 15);
+ H = hi * hi + ( med >> 15 );
med <<= 17;
- L = lo*lo + med;
- if (L < med) H++;
+ L = lo * lo + med;
+ if ( L < med )
+ H++;
hi = (TT_ULong)v >> 16;
lo = (TT_ULong)v & 0xFFFF;
- med = hi*lo;
+ med = hi * lo;
- H += hi*hi + (med >> 15);
+ H += hi * hi + ( med >> 15 );
med <<= 17;
- L2 = lo*lo + med;
- if (L2 < med) H++;
+ L2 = lo * lo + med;
+ if ( L2 < med )
+ H++;
L += L2;
- if (L < L2) H++;
+ if ( L < L2 )
+ H++;
/* if the value is smaller than 32-bits */
- if (H == 0)
+ if ( H == 0 )
{
shift = 0;
- while ((L & 0xC0000000) == 0)
+ while ( ( L & 0xC0000000L ) == 0 )
{
L <<= 2;
shift++;
}
- d = FT_Sqrt32(L);
+ d = FT_Sqrt32( L );
R->x = (TT_F2Dot14)TT_MULDIV( Vx << shift, 0x4000, d );
R->y = (TT_F2Dot14)TT_MULDIV( Vy << shift, 0x4000, d );
}
@@ -2302,14 +2355,14 @@
else
{
shift = 0;
- while (H)
+ while ( H )
{
- L = (L >> 2) | (H << 30);
+ L = ( L >> 2 ) | ( H << 30 );
H >>= 2;
shift++;
}
- d = FT_Sqrt32(L);
+ d = FT_Sqrt32( L );
R->x = (TT_F2Dot14)TT_MULDIV( Vx >> shift, 0x4000, d );
R->y = (TT_F2Dot14)TT_MULDIV( Vy >> shift, 0x4000, d );
}
@@ -2318,38 +2371,47 @@
TT_ULong x, y, w;
TT_Int sx, sy;
- sx = ( R->x >= 0 ? 1 : -1 );
- sy = ( R->y >= 0 ? 1 : -1 );
- x = (TT_ULong)sx*R->x;
- y = (TT_ULong)sy*R->y;
- w = x*x+y*y;
+ sx = R->x >= 0 ? 1 : -1;
+ sy = R->y >= 0 ? 1 : -1;
+ x = (TT_ULong)sx * R->x;
+ y = (TT_ULong)sy * R->y;
+
+ w = x * x + y * y;
/* we now want to adjust (x,y) in order to have sqrt(w) == 0x4000 */
/* which means 0x1000000 <= w < 0x1004000 */
while ( w <= 0x10000000L )
{
/* increment the smallest coordinate */
- if ( x < y ) x++;
- else y++;
+ if ( x < y )
+ x++;
+ else
+ y++;
- w = x*x+y*y;
+ w = x * x + y * y;
}
while ( w >= 0x10040000L )
{
/* decrement the smallest coordinate */
- if ( x < y ) x--;
- else y--;
- w = x*x+y*y;
+ if ( x < y )
+ x--;
+ else
+ y--;
+
+ w = x * x + y * y;
}
- R->x = sx*x;
- R->y = sy*y;
+ R->x = sx * x;
+ R->y = sy * y;
}
+
return SUCCESS;
}
-#endif
+
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
+
/*************************************************************************/
/* */
@@ -2383,9 +2445,9 @@
A = p1->x - p2->x;
B = p1->y - p2->y;
- if ( (aOpc & 1) != 0 )
+ if ( ( aOpc & 1 ) != 0 )
{
- C = B; /* CounterClockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = -C;
}
@@ -2400,77 +2462,77 @@
/* call table defined later below in this source. Each opcode must */
/* thus have a corresponding function, even trivial ones. */
/* */
- /* They're all defined there. */
-
-#define DO_SVTCA \
- { \
- TT_Short A, B; \
- \
- \
- A = (TT_Short)(CUR.opcode & 1) << 14; \
- B = A ^ (TT_Short)0x4000; \
- \
- CUR.GS.freeVector.x = A; \
- CUR.GS.projVector.x = A; \
- CUR.GS.dualVector.x = A; \
- \
- CUR.GS.freeVector.y = B; \
- CUR.GS.projVector.y = B; \
- CUR.GS.dualVector.y = B; \
- \
- COMPUTE_Funcs(); \
- }
-
-
-#define DO_SPVTCA \
- { \
- TT_Short A, B; \
- \
- \
- A = (TT_Short)(CUR.opcode & 1) << 14; \
- B = A ^ (TT_Short)0x4000; \
- \
- CUR.GS.projVector.x = A; \
- CUR.GS.dualVector.x = A; \
- \
- CUR.GS.projVector.y = B; \
- CUR.GS.dualVector.y = B; \
- \
- COMPUTE_Funcs(); \
- }
-
-
-#define DO_SFVTCA \
- { \
- TT_Short A, B; \
- \
- \
- A = (TT_Short)(CUR.opcode & 1) << 14; \
- B = A ^ (TT_Short)0x4000; \
- \
- CUR.GS.freeVector.x = A; \
- CUR.GS.freeVector.y = B; \
- \
- COMPUTE_Funcs(); \
- }
-
-
-#define DO_SPVTL \
- if ( INS_SxVTL( (TT_UShort)args[1], \
- (TT_UShort)args[0], \
- CUR.opcode, \
- &CUR.GS.projVector) == SUCCESS ) \
- { \
- CUR.GS.dualVector = CUR.GS.projVector; \
- COMPUTE_Funcs(); \
- }
-
-
-#define DO_SFVTL \
- if ( INS_SxVTL( (TT_UShort)(args[1]), \
- (TT_UShort)(args[0]), \
- CUR.opcode, \
- &CUR.GS.freeVector) == SUCCESS ) \
+ /* They are all defined there. */
+
+#define DO_SVTCA \
+ { \
+ TT_Short A, B; \
+ \
+ \
+ A = (TT_Short)( CUR.opcode & 1 ) << 14; \
+ B = A ^ (TT_Short)0x4000; \
+ \
+ CUR.GS.freeVector.x = A; \
+ CUR.GS.projVector.x = A; \
+ CUR.GS.dualVector.x = A; \
+ \
+ CUR.GS.freeVector.y = B; \
+ CUR.GS.projVector.y = B; \
+ CUR.GS.dualVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SPVTCA \
+ { \
+ TT_Short A, B; \
+ \
+ \
+ A = (TT_Short)( CUR.opcode & 1 ) << 14; \
+ B = A ^ (TT_Short)0x4000; \
+ \
+ CUR.GS.projVector.x = A; \
+ CUR.GS.dualVector.x = A; \
+ \
+ CUR.GS.projVector.y = B; \
+ CUR.GS.dualVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SFVTCA \
+ { \
+ TT_Short A, B; \
+ \
+ \
+ A = (TT_Short)( CUR.opcode & 1 ) << 14; \
+ B = A ^ (TT_Short)0x4000; \
+ \
+ CUR.GS.freeVector.x = A; \
+ CUR.GS.freeVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SPVTL \
+ if ( INS_SxVTL( (TT_UShort)args[1], \
+ (TT_UShort)args[0], \
+ CUR.opcode, \
+ &CUR.GS.projVector ) == SUCCESS ) \
+ { \
+ CUR.GS.dualVector = CUR.GS.projVector; \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SFVTL \
+ if ( INS_SxVTL( (TT_UShort)args[1], \
+ (TT_UShort)args[0], \
+ CUR.opcode, \
+ &CUR.GS.freeVector ) == SUCCESS ) \
COMPUTE_Funcs();
@@ -2525,16 +2587,16 @@
args[1] = CUR.GS.freeVector.y;
-#define DO_SRP0 \
- CUR.GS.rp0 = (TT_UShort)(args[0]);
+#define DO_SRP0 \
+ CUR.GS.rp0 = (TT_UShort)args[0];
-#define DO_SRP1 \
- CUR.GS.rp1 = (TT_UShort)(args[0]);
+#define DO_SRP1 \
+ CUR.GS.rp1 = (TT_UShort)args[0];
-#define DO_SRP2 \
- CUR.GS.rp2 = (TT_UShort)(args[0]);
+#define DO_SRP2 \
+ CUR.GS.rp2 = (TT_UShort)args[0];
#define DO_RTHG \
@@ -2602,10 +2664,10 @@
/* */
/* It seems that the value that is read here is */
/* expressed in 16.16 format rather than in font */
- /* units.. . */
+ /* units.. */
/* */
-#define DO_SSW \
- CUR.GS.single_width_value = (TT_F26Dot6)(args[0] >> 10);
+#define DO_SSW \
+ CUR.GS.single_width_value = (TT_F26Dot6)( args[0] >> 10 );
#define DO_FLIPON \
@@ -2631,15 +2693,20 @@
args[0] = CURRENT_Ppem();
-/* Note: the pointSize should be irrelevant in a given font program */
-/* we thus decide to return only the ppem */
+ /* Note: The pointSize should be irrelevant in a given font program; */
+ /* we thus decide to return only the ppem. */
#if 0
+
#define DO_MPS \
args[0] = CUR.metrics.pointSize;
+
#else
-#define DO_MPS \
+
+#define DO_MPS \
args[0] = CURRENT_Ppem();
-#endif
+
+#endif /* 0 */
+
#define DO_DUP \
args[1] = args[0];
@@ -2653,6 +2720,7 @@
{ \
TT_Long L; \
\
+ \
L = args[0]; \
args[0] = args[1]; \
args[1] = L; \
@@ -2698,36 +2766,36 @@
}
-#define DO_LT \
- args[0] = (args[0] < args[1]);
+#define DO_LT \
+ args[0] = ( args[0] < args[1] );
-#define DO_LTEQ \
- args[0] = (args[0] <= args[1]);
+#define DO_LTEQ \
+ args[0] = ( args[0] <= args[1] );
-#define DO_GT \
- args[0] = (args[0] > args[1]);
+#define DO_GT \
+ args[0] = ( args[0] > args[1] );
-#define DO_GTEQ \
- args[0] = (args[0] >= args[1]);
+#define DO_GTEQ \
+ args[0] = ( args[0] >= args[1] );
-#define DO_EQ \
- args[0] = (args[0] == args[1]);
+#define DO_EQ \
+ args[0] = ( args[0] == args[1] );
-#define DO_NEQ \
- args[0] = (args[0] != args[1]);
+#define DO_NEQ \
+ args[0] = ( args[0] != args[1] );
-#define DO_ODD \
- args[0] = ( (CUR_Func_round( args[0], 0 ) & 127) == 64 );
+#define DO_ODD \
+ args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 64 );
-#define DO_EVEN \
- args[0] = ( (CUR_Func_round( args[0], 0 ) & 127) == 0 );
+#define DO_EVEN \
+ args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 0 );
#define DO_AND \
@@ -2774,7 +2842,7 @@
#define DO_CEILING \
- args[0] = (args[0] + 63) & (-64);
+ args[0] = ( args[0] + 63 ) & -64;
#define DO_RS \
@@ -2813,22 +2881,22 @@
}
-#define DO_RCVT \
- { \
- TT_ULong I = (TT_ULong)args[0]; \
- \
- \
- if ( BOUNDS( I, CUR.cvtSize ) ) \
- { \
- if ( CUR.pedantic_hinting ) \
- { \
- ARRAY_BOUND_ERROR; \
- } \
- else \
- args[0] = 0; \
- } \
- else \
- args[0] = CUR_Func_read_cvt(I); \
+#define DO_RCVT \
+ { \
+ TT_ULong I = (TT_ULong)args[0]; \
+ \
+ \
+ if ( BOUNDS( I, CUR.cvtSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ else \
+ args[0] = 0; \
+ } \
+ else \
+ args[0] = CUR_Func_read_cvt( I ); \
}
@@ -2895,11 +2963,11 @@
#undef ARRAY_BOUND_ERROR
-#define ARRAY_BOUND_ERROR \
- { \
- CUR.error = TT_Err_Invalid_Reference; \
- return; \
- }
+#define ARRAY_BOUND_ERROR \
+ { \
+ CUR.error = TT_Err_Invalid_Reference; \
+ return; \
+ }
/*************************************************************************/
@@ -3330,7 +3398,7 @@
/*************************************************************************/
/* */
- /* DUP[]: DUPlicate top stack element */
+ /* DUP[]: DUPlicate the top stack's element */
/* Opcode range: 0x20 */
/* Stack: StkElt --> StkElt StkElt */
/* */
@@ -3343,7 +3411,7 @@
/*************************************************************************/
/* */
- /* POP[]: POP the stack's top elt */
+ /* POP[]: POP the stack's top element */
/* Opcode range: 0x21 */
/* Stack: StkElt --> */
/* */
@@ -3369,7 +3437,7 @@
/*************************************************************************/
/* */
- /* SWAP[]: SWAP the top two elements */
+ /* SWAP[]: SWAP the stack's top two elements */
/* Opcode range: 0x23 */
/* Stack: 2 * StkElt --> 2 * StkElt */
/* */
@@ -3785,11 +3853,11 @@
/*************************************************************************/
/* */
- /* DEBUG[]: DEBUG. Unsupported */
+ /* DEBUG[]: DEBUG. Unsupported. */
/* Opcode range: 0x4F */
/* Stack: uint32 --> */
/* */
- /* Note: The original instruction pops a value from the stack */
+ /* Note: The original instruction pops a value from the stack. */
/* */
static
void Ins_DEBUG( INS_ARG )
@@ -3882,9 +3950,9 @@
K = CUR.stack[CUR.args - L];
- MEM_Move( (&CUR.stack[CUR.args - L ]),
- (&CUR.stack[CUR.args - L + 1]),
- (L - 1) * sizeof ( TT_Long ) );
+ MEM_Move( &CUR.stack[CUR.args - L ],
+ &CUR.stack[CUR.args - L + 1],
+ ( L - 1 ) * sizeof ( TT_Long ) );
CUR.stack[CUR.args - 1] = K;
}
@@ -3901,9 +3969,9 @@
{
TT_Long A, B, C;
-
UNUSED_EXEC;
+
A = args[2];
B = args[1];
C = args[0];
@@ -3918,7 +3986,7 @@
/* */
/* MANAGING THE FLOW OF CONTROL */
/* */
- /* Instructions appear in the specs' order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -3981,12 +4049,12 @@
break;
case 0x1B: /* ELSE */
- Out = (nIfs == 1);
+ Out = ( nIfs == 1 );
break;
case 0x59: /* EIF */
nIfs--;
- Out = (nIfs == 0);
+ Out = ( nIfs == 0 );
break;
}
} while ( Out == 0 );
@@ -4004,9 +4072,9 @@
{
TT_Int nIfs;
-
UNUSED_ARG;
+
nIfs = 1;
do
@@ -4032,7 +4100,7 @@
/* */
/* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
/* */
- /* Instructions appear in the specs' order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4050,15 +4118,17 @@
TT_DefRecord* rec;
TT_DefRecord* limit;
+
/* some font programs are broken enough to redefine functions! */
- /* We will then parse the current table.. */
+ /* We will then parse the current table. */
+
rec = CUR.FDefs;
limit = rec + CUR.numFDefs;
n = args[0];
for ( ; rec < limit; rec++ )
{
- if (rec->opc == n)
+ if ( rec->opc == n )
break;
}
@@ -4075,7 +4145,7 @@
rec->range = CUR.curRange;
rec->opc = n;
- rec->start = CUR.IP+1;
+ rec->start = CUR.IP + 1;
rec->active = TRUE;
if ( n > CUR.maxFunc )
@@ -4111,9 +4181,9 @@
{
TT_CallRec* pRec;
-
UNUSED_ARG;
+
if ( CUR.callTop <= 0 ) /* We encountered an ENDF without a call */
{
CUR.error = TT_Err_ENDF_In_Exec_Stream;
@@ -4138,13 +4208,13 @@
INS_Goto_CodeRange( pRec->Caller_Range,
pRec->Caller_IP );
- /* Exit the current call frame. */
+ /* Exit the current call frame. */
- /* NOTE: When the last intruction of a program */
- /* is a CALL or LOOPCALL, the return address */
- /* is always out of the code range. This is */
- /* a valid address, and it's why we do not test */
- /* the result of Ins_Goto_CodeRange() here! */
+ /* NOTE: If the last intruction of a program is a */
+ /* CALL or LOOPCALL, the return address is */
+ /* always out of the code range. This is a */
+ /* valid address, and it is why we do not test */
+ /* the result of Ins_Goto_CodeRange() here! */
}
@@ -4161,12 +4231,15 @@
TT_CallRec* pCrec;
TT_DefRecord* def;
+
/* first of all, check the index */
+
F = args[0];
- if ( BOUNDS( F, CUR.maxFunc+1 ) ) goto Fail;
+ if ( BOUNDS( F, CUR.maxFunc + 1 ) )
+ goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */
- /* font are defined in increasing order, starting from 0. This */
+ /* font are defined in increasing order, starting from 0. This */
/* means that we normally have */
/* */
/* CUR.maxFunc+1 == CUR.numFDefs */
@@ -4175,22 +4248,24 @@
/* If this isn't true, we need to look up the function table. */
def = CUR.FDefs + F;
- if ( CUR.maxFunc+1 != CUR.numFDefs || def->opc != F )
+ if ( CUR.maxFunc + 1 != CUR.numFDefs || def->opc != F )
{
/* look up the FDefs table */
TT_DefRecord* limit;
+
def = CUR.FDefs;
limit = def + CUR.numFDefs;
- while (def < limit && def->opc != F)
+ while ( def < limit && def->opc != F )
def++;
- if (def == limit) goto Fail;
+ if ( def == limit )
+ goto Fail;
}
/* check that the function is active */
- if (!def->active)
+ if ( !def->active )
goto Fail;
/* check the call stack */
@@ -4233,12 +4308,14 @@
TT_CallRec* pCrec;
TT_DefRecord* def;
+
/* first of all, check the index */
F = args[1];
- if ( BOUNDS( F, CUR.maxFunc+1 ) ) goto Fail;
+ if ( BOUNDS( F, CUR.maxFunc + 1 ) )
+ goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */
- /* font are defined in increasing order, starting from 0. This */
+ /* font are defined in increasing order, starting from 0. This */
/* means that we normally have */
/* */
/* CUR.maxFunc+1 == CUR.numFDefs */
@@ -4247,22 +4324,24 @@
/* If this isn't true, we need to look up the function table. */
def = CUR.FDefs + F;
- if ( CUR.maxFunc+1 != CUR.numFDefs || def->opc != F )
+ if ( CUR.maxFunc + 1 != CUR.numFDefs || def->opc != F )
{
/* look up the FDefs table */
TT_DefRecord* limit;
+
def = CUR.FDefs;
limit = def + CUR.numFDefs;
- while (def < limit && def->opc != F)
+ while ( def < limit && def->opc != F )
def++;
- if (def == limit) goto Fail;
+ if ( def == limit )
+ goto Fail;
}
/* check that the function is active */
- if (!def->active)
+ if ( !def->active )
goto Fail;
/* check stack */
@@ -4278,7 +4357,7 @@
pCrec->Caller_Range = CUR.curRange;
pCrec->Caller_IP = CUR.IP + 1;
- pCrec->Cur_Count = (TT_Int)(args[0]);
+ pCrec->Cur_Count = (TT_Int)args[0];
pCrec->Cur_Restart = def->start;
CUR.callTop++;
@@ -4306,11 +4385,14 @@
TT_DefRecord* def;
TT_DefRecord* limit;
+
/* First of all, look for the same function in our table */
+
def = CUR.IDefs;
limit = def + CUR.numIDefs;
+
for ( ; def < limit; def++ )
- if (def->opc == (TT_ULong)args[0] )
+ if ( def->opc == (TT_ULong)args[0] )
break;
if ( def == limit )
@@ -4354,7 +4436,7 @@
/* */
/* PUSHING DATA ONTO THE INTERPRETER STACK */
/* */
- /* Instructions appear in the specs' order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4635,9 +4717,9 @@
B = v1->y - v2->y;
}
- if ( (CUR.opcode & 1) != 0 )
+ if ( ( CUR.opcode & 1 ) != 0 )
{
- C = B; /* CounterClockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = -C;
}
@@ -4653,9 +4735,9 @@
B = v1->y - v2->y;
}
- if ( (CUR.opcode & 1) != 0 )
+ if ( ( CUR.opcode & 1 ) != 0 )
{
- C = B; /* CounterClockwise rotation */
+ C = B; /* counter clockwise rotation */
B = A;
A = -C;
}
@@ -4691,7 +4773,7 @@
return;
}
- CUR.GS.gep0 = (TT_UShort)(args[0]);
+ CUR.GS.gep0 = (TT_UShort)args[0];
}
@@ -4720,7 +4802,7 @@
return;
}
- CUR.GS.gep1 = (TT_UShort)(args[0]);
+ CUR.GS.gep1 = (TT_UShort)args[0];
}
@@ -4749,7 +4831,7 @@
return;
}
- CUR.GS.gep2 = (TT_UShort)(args[0]);
+ CUR.GS.gep2 = (TT_UShort)args[0];
}
@@ -4781,9 +4863,9 @@
CUR.zp1 = CUR.zp0;
CUR.zp2 = CUR.zp0;
- CUR.GS.gep0 = (TT_UShort)(args[0]);
- CUR.GS.gep1 = (TT_UShort)(args[0]);
- CUR.GS.gep2 = (TT_UShort)(args[0]);
+ CUR.GS.gep0 = (TT_UShort)args[0];
+ CUR.GS.gep1 = (TT_UShort)args[0];
+ CUR.GS.gep2 = (TT_UShort)args[0];
}
@@ -4830,7 +4912,7 @@
/* Get Threshold */
- A = (TT_Int)(args[0] & 0xFF);
+ A = (TT_Int)( args[0] & 0xFF );
if ( A == 0xFF )
{
@@ -4845,10 +4927,10 @@
A *= 64;
- /*
+#if 0
if ( (args[0] & 0x100) != 0 && CUR.metrics.pointSize <= A )
CUR.GS.scan_control = TRUE;
- */
+#endif
if ( (args[0] & 0x200) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = TRUE;
@@ -4856,10 +4938,10 @@
if ( (args[0] & 0x400) != 0 && CUR.tt_metrics.stretched )
CUR.GS.scan_control = TRUE;
- /*
+#if 0
if ( (args[0] & 0x800) != 0 && CUR.metrics.pointSize > A )
CUR.GS.scan_control = FALSE;
- */
+#endif
if ( (args[0] & 0x1000) != 0 && CUR.tt_metrics.rotated )
CUR.GS.scan_control = FALSE;
@@ -4895,7 +4977,7 @@
/* */
/* MANAGING OUTLINES */
/* */
- /* Instructions appear in the specs' order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -5036,16 +5118,21 @@
d = CUR_Func_project( zp.cur + p, zp.org + p );
#ifdef NO_APPLE_PATENT
+
*x = TT_MULDIV( d, CUR.GS.freeVector.x, 0x4000 );
*y = TT_MULDIV( d, CUR.GS.freeVector.y, 0x4000 );
+
#else
+
*x = TT_MULDIV( d,
(TT_Long)CUR.GS.freeVector.x * 0x10000L,
CUR.F_dot_P );
*y = TT_MULDIV( d,
(TT_Long)CUR.GS.freeVector.y * 0x10000L,
CUR.F_dot_P );
-#endif
+
+#endif /* NO_APPLE_PATENT */
+
return SUCCESS;
}
@@ -5088,9 +5175,9 @@
dy;
TT_UShort point;
-
UNUSED_ARG;
+
if ( CUR.top < CUR.GS.loop )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -5282,7 +5369,7 @@
static
void Ins_MSIRP( INS_ARG )
{
- TT_UShort point;
+ TT_UShort point;
TT_F26Dot6 distance;
@@ -5341,7 +5428,7 @@
/* XXX: Is there some undocumented feature while in the */
/* twilight zone? ? */
- if ( (CUR.opcode & 1) != 0 )
+ if ( ( CUR.opcode & 1 ) != 0 )
{
cur_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
distance = CUR_Func_round( cur_dist,
@@ -5399,7 +5486,7 @@
/* some key font heights. It allows the use of the */
/* IP instruction in the twilight zone, which */
/* otherwise would be `illegal' according to the */
- /* specs :) */
+ /* specification. */
/* */
/* We implement it with a special sequence for the */
/* twilight zone. This is a bad hack, but it seems */
@@ -5418,7 +5505,7 @@
org_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
- if ( (CUR.opcode & 1) != 0 ) /* rounding and control cutin flag */
+ if ( ( CUR.opcode & 1 ) != 0 ) /* rounding and control cutin flag */
{
if ( ABS( distance - org_dist ) > CUR.GS.control_value_cutin )
distance = org_dist;
@@ -5474,16 +5561,18 @@
/* round flag */
- if ( (CUR.opcode & 4) != 0 )
- distance = CUR_Func_round( org_dist,
- CUR.tt_metrics.compensations[CUR.opcode & 3] );
+ if ( ( CUR.opcode & 4 ) != 0 )
+ distance = CUR_Func_round(
+ org_dist,
+ CUR.tt_metrics.compensations[CUR.opcode & 3] );
else
- distance = ROUND_None( org_dist,
- CUR.tt_metrics.compensations[CUR.opcode & 3] );
+ distance = ROUND_None(
+ org_dist,
+ CUR.tt_metrics.compensations[CUR.opcode & 3] );
/* minimum distance flag */
- if ( (CUR.opcode & 8) != 0 )
+ if ( ( CUR.opcode & 8 ) != 0 )
{
if ( org_dist >= 0 )
{
@@ -5507,7 +5596,7 @@
CUR.GS.rp1 = CUR.GS.rp0;
CUR.GS.rp2 = point;
- if ( (CUR.opcode & 16) != 0 )
+ if ( ( CUR.opcode & 16 ) != 0 )
CUR.GS.rp0 = point;
}
@@ -5531,7 +5620,7 @@
point = (TT_UShort)args[0];
- cvtEntry = (TT_ULong)(args[1] + 1);
+ cvtEntry = (TT_ULong)( args[1] + 1 );
/* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
@@ -5586,13 +5675,13 @@
if ( CUR.GS.auto_flip )
{
- if ( (org_dist ^ cvt_dist) < 0 )
+ if ( ( org_dist ^ cvt_dist ) < 0 )
cvt_dist = -cvt_dist;
}
/* control value cutin and round */
- if ( (CUR.opcode & 4) != 0 )
+ if ( ( CUR.opcode & 4 ) != 0 )
{
/* XXX: UNDOCUMENTED! Only perform cut-in test when both points */
/* refer to the same zone. */
@@ -5601,16 +5690,18 @@
if ( ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin )
cvt_dist = org_dist;
- distance = CUR_Func_round( cvt_dist,
- CUR.tt_metrics.compensations[CUR.opcode & 3] );
+ distance = CUR_Func_round(
+ cvt_dist,
+ CUR.tt_metrics.compensations[CUR.opcode & 3] );
}
else
- distance = ROUND_None( cvt_dist,
- CUR.tt_metrics.compensations[CUR.opcode & 3] );
+ distance = ROUND_None(
+ cvt_dist,
+ CUR.tt_metrics.compensations[CUR.opcode & 3] );
/* minimum distance test */
- if ( (CUR.opcode & 8) != 0 )
+ if ( ( CUR.opcode & 8 ) != 0 )
{
if ( org_dist >= 0 )
{
@@ -5628,7 +5719,7 @@
CUR.GS.rp1 = CUR.GS.rp0;
- if ( (CUR.opcode & 16) != 0 )
+ if ( ( CUR.opcode & 16 ) != 0 )
CUR.GS.rp0 = point;
/* XXX: UNDOCUMENTED! */
@@ -5649,9 +5740,9 @@
TT_UShort point;
TT_F26Dot6 distance;
-
UNUSED_ARG;
+
if ( CUR.top < CUR.GS.loop ||
BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
{
@@ -5818,9 +5909,9 @@
distance;
TT_UShort point;
-
UNUSED_ARG;
+
if ( CUR.top < CUR.GS.loop )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -5936,14 +6027,16 @@
};
- static void Shift( TT_UInt p1,
- TT_UInt p2,
- TT_UInt p,
- struct LOC_Ins_IUP* LINK )
+ static
+ void Shift( TT_UInt p1,
+ TT_UInt p2,
+ TT_UInt p,
+ struct LOC_Ins_IUP* LINK )
{
TT_UInt i;
TT_F26Dot6 x;
+
x = LINK->curs[p].x - LINK->orgs[p].x;
for ( i = p1; i < p; i++ )
@@ -5954,15 +6047,17 @@
}
- static void Interp( TT_UInt p1,
- TT_UInt p2,
- TT_UInt ref1,
- TT_UInt ref2,
- struct LOC_Ins_IUP* LINK )
+ static
+ void Interp( TT_UInt p1,
+ TT_UInt p2,
+ TT_UInt ref1,
+ TT_UInt ref2,
+ struct LOC_Ins_IUP* LINK )
{
TT_UInt i;
TT_F26Dot6 x, x1, x2, d1, d2;
+
if ( p1 > p2 )
return;
@@ -6053,9 +6148,9 @@
TT_UInt point; /* current point */
TT_Short contour; /* current contour */
-
UNUSED_ARG;
+
if ( CUR.opcode & 1 )
{
mask = FT_Curve_Tag_Touch_X;
@@ -6065,8 +6160,8 @@
else
{
mask = FT_Curve_Tag_Touch_Y;
- V.orgs = (TT_Vector*)( ((TT_F26Dot6*)CUR.pts.org) + 1 );
- V.curs = (TT_Vector*)( ((TT_F26Dot6*)CUR.pts.cur) + 1 );
+ V.orgs = (TT_Vector*)( (TT_F26Dot6*)CUR.pts.org + 1 );
+ V.curs = (TT_Vector*)( (TT_F26Dot6*)CUR.pts.cur + 1 );
}
contour = 0;
@@ -6089,7 +6184,7 @@
while ( point <= end_point )
{
- if ( (CUR.pts.tags[point] & mask) != 0 )
+ if ( ( CUR.pts.tags[point] & mask ) != 0 )
{
if ( point > 0 )
Interp( cur_touched + 1,
@@ -6107,7 +6202,7 @@
Shift( first_point, end_point, cur_touched, &V );
else
{
- Interp( (TT_UShort)(cur_touched + 1),
+ Interp( (TT_UShort)( cur_touched + 1 ),
end_point,
cur_touched,
first_touched,
@@ -6157,15 +6252,15 @@
A = (TT_UShort)CUR.stack[CUR.args + 1];
B = CUR.stack[CUR.args];
- /* XXX : because some popular fonts contain some invalid DeltaP */
- /* instructions, we simply ignore them when the stacked */
- /* point reference is off limit, rather than returning an */
- /* error. As a delta instruction doesn't change a glyph */
- /* in great ways, this shouldn't be a problem.. */
+ /* XXX: Because some popular fonts contain some invalid DeltaP */
+ /* instructions, we simply ignore them when the stacked */
+ /* point reference is off limit, rather than returning an */
+ /* error. As a delta instruction doesn't change a glyph */
+ /* in great ways, this shouldn't be a problem. */
if ( !BOUNDS( A, CUR.zp0.n_points ) )
{
- C = ((TT_ULong)B & 0xF0) >> 4;
+ C = ( (TT_ULong)B & 0xF0 ) >> 4;
switch ( CUR.opcode )
{
@@ -6185,10 +6280,10 @@
if ( CURRENT_Ppem() == (TT_Long)C )
{
- B = ((TT_ULong)B & 0xF) - 8;
+ B = ( (TT_ULong)B & 0xF ) - 8;
if ( B >= 0 )
B++;
- B = B * 64 / (1L << CUR.GS.delta_shift);
+ B = B * 64 / ( 1L << CUR.GS.delta_shift );
CUR_Func_move( &CUR.zp0, A, B );
}
@@ -6233,7 +6328,7 @@
if ( BOUNDS( A, CUR.cvtSize ) )
{
- if (CUR.pedantic_hinting)
+ if ( CUR.pedantic_hinting )
{
CUR.error = TT_Err_Invalid_Reference;
return;
@@ -6241,7 +6336,7 @@
}
else
{
- C = ((TT_ULong)B & 0xF0) >> 4;
+ C = ( (TT_ULong)B & 0xF0 ) >> 4;
switch ( CUR.opcode )
{
@@ -6261,10 +6356,10 @@
if ( CURRENT_Ppem() == (TT_Long)C )
{
- B = ((TT_ULong)B & 0xF) - 8;
+ B = ( (TT_ULong)B & 0xF ) - 8;
if ( B >= 0 )
B++;
- B = B * 64 / (1L << CUR.GS.delta_shift);
+ B = B * 64 / ( 1L << CUR.GS.delta_shift );
CUR_Func_move_cvt( A, B );
}
@@ -6300,7 +6395,7 @@
/* We return then Windows 3.1 version number */
/* for the font scaler */
- if ( (args[0] & 1) != 0 )
+ if ( ( args[0] & 1 ) != 0 )
K = 3;
/* Has the glyph been rotated ? */
@@ -6323,12 +6418,14 @@
UNUSED_ARG;
+
for ( ; def < limit; def++ )
{
- if (def->opc == CUR.opcode && def->active )
+ if ( def->opc == CUR.opcode && def->active )
{
TT_CallRec* call;
+
if ( CUR.callTop >= CUR.callSize )
{
CUR.error = TT_Err_Stack_Overflow;
@@ -6354,6 +6451,8 @@
#ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
static
TInstruction_Function Instruct_Dispatch[256] =
{
@@ -6632,6 +6731,8 @@
/* MIRP[30] */ Ins_MIRP,
/* MIRP[31] */ Ins_MIRP
};
+
+
#endif /* !TT_CONFIG_OPTION_INTERPRETER_SWITCH */
@@ -6656,24 +6757,46 @@
/* */
/* */
/* Note: The documented DEBUG opcode pops a value from the stack. This */
- /* behaviour is unsupported, here a DEBUG opcode is always an */
+ /* behaviour is unsupported; here a DEBUG opcode is always an */
/* error. */
/* */
/* */
/* THIS IS THE INTERPRETER'S MAIN LOOP. */
/* */
- /* Instructions appear in the specs' order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
- FT_EXPORT_FUNC(TT_Error) TT_RunIns( TT_ExecContext exc )
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_RunIns */
+ /* */
+ /* <Description> */
+ /* Executes one or more instruction in the execution context. This */
+ /* is the main function of the TrueType opcode interpreter. */
+ /* */
+ /* <Input> */
+ /* exec :: A handle to the target execution context. */
+ /* */
+ /* <Return> */
+ /* TrueType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* Only the object manager and debugger should call this function. */
+ /* */
+ /* This function is publicly exported because it is directly */
+ /* invoked by the TrueType debugger. */
+ /* */
+ FT_EXPORT_FUNC( TT_Error ) TT_RunIns( TT_ExecContext exc )
{
- TT_Long ins_counter = 0; /* executed instructions counter */
+ TT_Long ins_counter = 0; /* executed instructions counter */
- #ifdef TT_CONFIG_OPTION_STATIC_RASTER
+
+#ifdef TT_CONFIG_OPTION_STATIC_RASTER
cur = *exc;
- #endif
+#endif
/* set CVT functions */
CUR.tt_metrics.ratio = 0;
@@ -6711,7 +6834,7 @@
goto LErrorCodeOverflow_;
/* First, let's check for empty stack and overflow */
- CUR.args = CUR.top - (Pop_Push_Count[CUR.opcode] >> 4);
+ CUR.args = CUR.top - ( Pop_Push_Count[CUR.opcode] >> 4 );
/* `args' is the top of the stack once arguments have been popped. */
/* One can also interpret it as the index of the last argument. */
@@ -6721,7 +6844,7 @@
goto LErrorLabel_;
}
- CUR.new_top = CUR.args + (Pop_Push_Count[CUR.opcode] & 15);
+ CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 );
/* `new_top' is the new top of the stack, after the instruction's */
/* execution. `top' will be set to `new_top' after the `switch' */
@@ -6736,13 +6859,14 @@
CUR.error = TT_Err_Ok;
#ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
{
TT_Long* args = CUR.stack + CUR.args;
TT_Byte opcode = CUR.opcode;
#undef ARRAY_BOUND_ERROR
-#define ARRAY_BOUND_ERROR goto Set_Invalid_Ref
+#define ARRAY_BOUND_ERROR goto Set_Invalid_Ref
switch ( opcode )
@@ -6757,7 +6881,7 @@
TT_Short AA, BB;
- AA = (TT_Short)(opcode & 1) << 14;
+ AA = (TT_Short)( opcode & 1 ) << 14;
BB = AA ^ (TT_Short)0x4000;
if ( opcode < 4 )
@@ -6769,7 +6893,7 @@
CUR.GS.dualVector.y = BB;
}
- if ( (opcode & 2) == 0 )
+ if ( ( opcode & 2 ) == 0 )
{
CUR.GS.freeVector.x = AA;
CUR.GS.freeVector.y = BB;
@@ -6810,7 +6934,7 @@
break;
case 0x0F: /* ISECT */
- Ins_ISECT( EXEC_ARG_ args );
+ Ins_ISECT( EXEC_ARG_ args );
break;
case 0x10: /* SRP0 */
@@ -6826,19 +6950,19 @@
break;
case 0x13: /* SZP0 */
- Ins_SZP0( EXEC_ARG_ args );
+ Ins_SZP0( EXEC_ARG_ args );
break;
case 0x14: /* SZP1 */
- Ins_SZP1( EXEC_ARG_ args );
+ Ins_SZP1( EXEC_ARG_ args );
break;
case 0x15: /* SZP2 */
- Ins_SZP2( EXEC_ARG_ args );
+ Ins_SZP2( EXEC_ARG_ args );
break;
case 0x16: /* SZPS */
- Ins_SZPS( EXEC_ARG_ args );
+ Ins_SZPS( EXEC_ARG_ args );
break;
case 0x17: /* SLOOP */
@@ -6858,7 +6982,7 @@
break;
case 0x1B: /* ELSE */
- Ins_ELSE( EXEC_ARG_ args );
+ Ins_ELSE( EXEC_ARG_ args );
break;
case 0x1C: /* JMPR */
@@ -6882,7 +7006,7 @@
break;
case 0x21: /* POP */
- /* nothing :-) ! */
+ /* nothing :-) */
break;
case 0x22: /* CLEAR */
@@ -6902,78 +7026,78 @@
break;
case 0x26: /* MINDEX */
- Ins_MINDEX( EXEC_ARG_ args );
+ Ins_MINDEX( EXEC_ARG_ args );
break;
case 0x27: /* ALIGNPTS */
- Ins_ALIGNPTS( EXEC_ARG_ args );
+ Ins_ALIGNPTS( EXEC_ARG_ args );
break;
case 0x28: /* ???? */
- Ins_UNKNOWN( EXEC_ARG_ args );
+ Ins_UNKNOWN( EXEC_ARG_ args );
break;
case 0x29: /* UTP */
- Ins_UTP( EXEC_ARG_ args );
+ Ins_UTP( EXEC_ARG_ args );
break;
case 0x2A: /* LOOPCALL */
- Ins_LOOPCALL( EXEC_ARG_ args );
+ Ins_LOOPCALL( EXEC_ARG_ args );
break;
case 0x2B: /* CALL */
- Ins_CALL( EXEC_ARG_ args );
+ Ins_CALL( EXEC_ARG_ args );
break;
case 0x2C: /* FDEF */
- Ins_FDEF( EXEC_ARG_ args );
+ Ins_FDEF( EXEC_ARG_ args );
break;
case 0x2D: /* ENDF */
- Ins_ENDF( EXEC_ARG_ args );
+ Ins_ENDF( EXEC_ARG_ args );
break;
case 0x2E: /* MDAP */
case 0x2F: /* MDAP */
- Ins_MDAP( EXEC_ARG_ args );
+ Ins_MDAP( EXEC_ARG_ args );
break;
case 0x30: /* IUP */
case 0x31: /* IUP */
- Ins_IUP( EXEC_ARG_ args );
+ Ins_IUP( EXEC_ARG_ args );
break;
case 0x32: /* SHP */
case 0x33: /* SHP */
- Ins_SHP( EXEC_ARG_ args );
+ Ins_SHP( EXEC_ARG_ args );
break;
case 0x34: /* SHC */
case 0x35: /* SHC */
- Ins_SHC( EXEC_ARG_ args );
+ Ins_SHC( EXEC_ARG_ args );
break;
case 0x36: /* SHZ */
case 0x37: /* SHZ */
- Ins_SHZ( EXEC_ARG_ args );
+ Ins_SHZ( EXEC_ARG_ args );
break;
case 0x38: /* SHPIX */
- Ins_SHPIX( EXEC_ARG_ args );
+ Ins_SHPIX( EXEC_ARG_ args );
break;
case 0x39: /* IP */
- Ins_IP( EXEC_ARG_ args );
+ Ins_IP( EXEC_ARG_ args );
break;
case 0x3A: /* MSIRP */
case 0x3B: /* MSIRP */
- Ins_MSIRP( EXEC_ARG_ args );
+ Ins_MSIRP( EXEC_ARG_ args );
break;
case 0x3C: /* AlignRP */
- Ins_ALIGNRP( EXEC_ARG_ args );
+ Ins_ALIGNRP( EXEC_ARG_ args );
break;
case 0x3D: /* RTDG */
@@ -6982,22 +7106,22 @@
case 0x3E: /* MIAP */
case 0x3F: /* MIAP */
- Ins_MIAP( EXEC_ARG_ args );
+ Ins_MIAP( EXEC_ARG_ args );
break;
case 0x40: /* NPUSHB */
- Ins_NPUSHB( EXEC_ARG_ args );
+ Ins_NPUSHB( EXEC_ARG_ args );
break;
case 0x41: /* NPUSHW */
- Ins_NPUSHW( EXEC_ARG_ args );
+ Ins_NPUSHW( EXEC_ARG_ args );
break;
case 0x42: /* WS */
DO_WS
break;
- Set_Invalid_Ref:
+ Set_Invalid_Ref:
CUR.error = TT_Err_Invalid_Reference;
break;
@@ -7015,16 +7139,16 @@
case 0x46: /* GC */
case 0x47: /* GC */
- Ins_GC( EXEC_ARG_ args );
+ Ins_GC( EXEC_ARG_ args );
break;
case 0x48: /* SCFS */
- Ins_SCFS( EXEC_ARG_ args );
+ Ins_SCFS( EXEC_ARG_ args );
break;
case 0x49: /* MD */
case 0x4A: /* MD */
- Ins_MD( EXEC_ARG_ args );
+ Ins_MD( EXEC_ARG_ args );
break;
case 0x4B: /* MPPEM */
@@ -7080,7 +7204,7 @@
break;
case 0x58: /* IF */
- Ins_IF( EXEC_ARG_ args );
+ Ins_IF( EXEC_ARG_ args );
break;
case 0x59: /* EIF */
@@ -7100,7 +7224,7 @@
break;
case 0x5D: /* DELTAP1 */
- Ins_DELTAP( EXEC_ARG_ args );
+ Ins_DELTAP( EXEC_ARG_ args );
break;
case 0x5E: /* SDB */
@@ -7163,13 +7287,13 @@
case 0x71: /* DELTAP2 */
case 0x72: /* DELTAP3 */
- Ins_DELTAP( EXEC_ARG_ args );
+ Ins_DELTAP( EXEC_ARG_ args );
break;
case 0x73: /* DELTAC0 */
case 0x74: /* DELTAC1 */
case 0x75: /* DELTAC2 */
- Ins_DELTAC( EXEC_ARG_ args );
+ Ins_DELTAC( EXEC_ARG_ args );
break;
case 0x76: /* SROUND */
@@ -7193,7 +7317,7 @@
break;
case 0x7B: /* ???? */
- Ins_UNKNOWN( EXEC_ARG_ args );
+ Ins_UNKNOWN( EXEC_ARG_ args );
break;
case 0x7C: /* RUTG */
@@ -7210,41 +7334,41 @@
break;
case 0x80: /* FLIPPT */
- Ins_FLIPPT( EXEC_ARG_ args );
+ Ins_FLIPPT( EXEC_ARG_ args );
break;
case 0x81: /* FLIPRGON */
- Ins_FLIPRGON( EXEC_ARG_ args );
+ Ins_FLIPRGON( EXEC_ARG_ args );
break;
case 0x82: /* FLIPRGOFF */
- Ins_FLIPRGOFF( EXEC_ARG_ args );
+ Ins_FLIPRGOFF( EXEC_ARG_ args );
break;
case 0x83: /* UNKNOWN */
case 0x84: /* UNKNOWN */
- Ins_UNKNOWN( EXEC_ARG_ args );
+ Ins_UNKNOWN( EXEC_ARG_ args );
break;
case 0x85: /* SCANCTRL */
- Ins_SCANCTRL( EXEC_ARG_ args );
+ Ins_SCANCTRL( EXEC_ARG_ args );
break;
case 0x86: /* SDPVTL */
case 0x87: /* SDPVTL */
- Ins_SDPVTL( EXEC_ARG_ args );
+ Ins_SDPVTL( EXEC_ARG_ args );
break;
case 0x88: /* GETINFO */
- Ins_GETINFO( EXEC_ARG_ args );
+ Ins_GETINFO( EXEC_ARG_ args );
break;
case 0x89: /* IDEF */
- Ins_IDEF( EXEC_ARG_ args );
+ Ins_IDEF( EXEC_ARG_ args );
break;
case 0x8A: /* ROLL */
- Ins_ROLL( EXEC_ARG_ args );
+ Ins_ROLL( EXEC_ARG_ args );
break;
case 0x8B: /* MAX */
@@ -7256,34 +7380,38 @@
break;
case 0x8D: /* SCANTYPE */
- Ins_SCANTYPE( EXEC_ARG_ args );
+ Ins_SCANTYPE( EXEC_ARG_ args );
break;
case 0x8E: /* INSTCTRL */
- Ins_INSTCTRL( EXEC_ARG_ args );
+ Ins_INSTCTRL( EXEC_ARG_ args );
break;
case 0x8F:
- Ins_UNKNOWN( EXEC_ARG_ args );
+ Ins_UNKNOWN( EXEC_ARG_ args );
break;
default:
if ( opcode >= 0xE0 )
- Ins_MIRP( EXEC_ARG_ args );
+ Ins_MIRP( EXEC_ARG_ args );
else if ( opcode >= 0xC0 )
- Ins_MDRP( EXEC_ARG_ args );
+ Ins_MDRP( EXEC_ARG_ args );
else if ( opcode >= 0xB8 )
- Ins_PUSHW( EXEC_ARG_ args );
+ Ins_PUSHW( EXEC_ARG_ args );
else if ( opcode >= 0xB0 )
- Ins_PUSHB( EXEC_ARG_ args );
+ Ins_PUSHB( EXEC_ARG_ args );
else
- Ins_UNKNOWN( EXEC_ARG_ args );
+ Ins_UNKNOWN( EXEC_ARG_ args );
}
}
+
#else
+
Instruct_Dispatch[CUR.opcode]( EXEC_ARG_ &CUR.stack[CUR.args] );
-#endif
+
+#endif /* TT_CONFIG_OPTION_INTERPRETER_SWITCH */
+
if ( CUR.error != TT_Err_Ok )
{
switch ( CUR.error )
@@ -7293,12 +7421,14 @@
TT_DefRecord* def = CUR.IDefs;
TT_DefRecord* limit = def + CUR.numIDefs;
+
for ( ; def < limit; def++ )
{
if ( def->active && CUR.opcode == def->opc )
{
TT_CallRec* callrec;
+
if ( CUR.callTop >= CUR.callSize )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -7322,12 +7452,19 @@
CUR.error = TT_Err_Invalid_Opcode;
goto LErrorLabel_;
-/* break; Unreachable code warning suppress. Leave in case a later
- change to remind the editor to consider break; */
+
+#if 0
+ break; /* Unreachable code warning suppression. */
+ /* Leave to remind in case a later change the editor */
+ /* to consider break; */
+#endif
default:
goto LErrorLabel_;
-/* break; */
+
+#if 0
+ break;
+#endif
}
}
@@ -7336,12 +7473,12 @@
if ( CUR.step_ins )
CUR.IP += CUR.length;
- /* increment instruction counter and check if we didn't */
- /* run this program for too long ?? (e.g. infinite loops) */
+ /* increment instruction counter and check if we didn't */
+ /* run this program for too long (e.g. infinite loops). */
if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
return TT_Err_Execution_Too_Long;
- LSuiteLabel_:
+ LSuiteLabel_:
if ( CUR.IP >= CUR.codeSize )
{
if ( CUR.callTop > 0 )
@@ -7355,22 +7492,27 @@
} while ( !CUR.instruction_trap );
LNo_Error_:
- #ifdef TT_CONFIG_OPTION_STATIC_RASTER
+
+#ifdef TT_CONFIG_OPTION_STATIC_RASTER
*exc = cur;
- #endif
+#endif
+
return TT_Err_Ok;
LErrorCodeOverflow_:
CUR.error = TT_Err_Code_Overflow;
LErrorLabel_:
- #ifdef TT_CONFIG_OPTION_STATIC_RASTER
+
+#ifdef TT_CONFIG_OPTION_STATIC_RASTER
*exc = cur;
- #endif
+#endif
+
return CUR.error;
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
/* END */
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 46333df..ae28c0f 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -2,13 +2,13 @@
/* */
/* ttinterp.h */
/* */
-/* TrueType bytecode intepreter (specification). */
+/* TrueType bytecode interpreter (specification). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -27,21 +27,21 @@
#endif
-#ifndef TT_STATIC_INTEPRETER /* indirect implementation */
+#ifndef TT_CONFIG_OPTION_STATIC_INTEPRETER /* indirect implementation */
#define EXEC_OP_ TT_ExecContext exc,
#define EXEC_OP TT_ExecContext exc
#define EXEC_ARG_ exc,
#define EXEC_ARG exc
-#else /* static implementation */
+#else /* static implementation */
#define EXEC_OP_ /* void */
#define EXEC_OP /* void */
#define EXEC_ARG_ /* void */
#define EXEC_ARG /* void */
-#endif /* TT_STATIC_INTERPRETER */
+#endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
/*************************************************************************/
@@ -215,253 +215,48 @@
} TT_ExecContextRec;
-
LOCAL_DEF
const TT_GraphicsState tt_default_graphics_state;
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Goto_CodeRange */
- /* */
- /* <Description> */
- /* Switches to a new code range (updates the code related elements in */
- /* `exec', and `IP'). */
- /* */
- /* <Input> */
- /* range :: The new execution code range. */
- /* IP :: The new IP in the new code range. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Goto_CodeRange( TT_ExecContext exec,
TT_Int range,
TT_Long IP );
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Set_CodeRange */
- /* */
- /* <Description> */
- /* Sets a code range. */
- /* */
- /* <Input> */
- /* range :: The code range index. */
- /* base :: The new code base. */
- /* length :: The range size in bytes. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Set_CodeRange( TT_ExecContext exec,
TT_Int range,
void* base,
TT_Long length );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Clear_CodeRange */
- /* */
- /* <Description> */
- /* Clears a code range. */
- /* */
- /* <Input> */
- /* range :: The code range index. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Does not set the Error variable. */
- /* */
LOCAL_DEF
TT_Error TT_Clear_CodeRange( TT_ExecContext exec,
TT_Int range );
+ FT_EXPORT_DEF( TT_ExecContext ) TT_New_Context( TT_Face face );
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_New_Context */
- /* */
- /* <Description> */
- /* Queries the face context for a given font. Note that there is */
- /* now a _single_ execution context in the TrueType driver which is */
- /* shared among faces. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Return> */
- /* A handle to the execution context. Initialized for `face'. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
- /* This function is publicly exported because it is directly */
- /* invoked by the TrueType debugger.. */
- /* */
- FT_EXPORT_DEF(TT_ExecContext) TT_New_Context( TT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Done_Context */
- /* */
- /* <Description> */
- /* Discards an execution context. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
LOCAL_DEF
TT_Error TT_Done_Context( TT_ExecContext exec );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Destroy_Context */
- /* */
- /* <Description> */
- /* Destroys a given context. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* memory :: A handle to the parent memory object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
LOCAL_DEF
TT_Error TT_Destroy_Context( TT_ExecContext exec,
FT_Memory memory );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Context */
- /* */
- /* <Description> */
- /* Prepare an execution context for glyph hinting. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* face :: A handle to the source face object. */
- /* size :: A handle to the source size object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
LOCAL_DEF
TT_Error TT_Load_Context( TT_ExecContext exec,
TT_Face face,
TT_Size size );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Save_Context */
- /* */
- /* <Description> */
- /* Saves the code ranges in a `size' object. */
- /* */
- /* <Input> */
- /* exec :: A handle to the source execution context. */
- /* */
- /* <Output> */
- /* ins :: A handle to the target size object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
LOCAL_DEF
TT_Error TT_Save_Context( TT_ExecContext exec,
TT_Size ins );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Run_Context */
- /* */
- /* <Description> */
- /* Executes one or more instructions in the execution context. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* debug :: A Boolean flag. If set, the function sets some internal */
- /* variables and returns immediately, otherwise TT_RunIns() */
- /* is called. */
- /* */
- /* <Return> */
- /* TrueTyoe error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
LOCAL_DEF
TT_Error TT_Run_Context( TT_ExecContext exec,
TT_Bool debug );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_RunIns */
- /* */
- /* <Description> */
- /* Executes one or more instruction in the execution context. This */
- /* is the main function of the TrueType opcode interpreter. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only object manager and debugger should call this function. */
- /* */
- /* This function is publicly exported because it is directly */
- /* invoked by the TrueType debugger.. */
- /* */
- FT_EXPORT_DEF(TT_Error) TT_RunIns( TT_ExecContext exec );
+ FT_EXPORT_DEF( TT_Error ) TT_RunIns( TT_ExecContext exec );
#ifdef __cplusplus
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index e05cb53..ee4c846 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,11 +4,11 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -33,7 +33,13 @@
#include <ttinterp.h>
#endif
-/* required by tracing mode */
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_ttobjs
@@ -45,8 +51,6 @@
/*************************************************************************/
-
-
/*************************************************************************/
/* */
/* <Function> */
@@ -56,8 +60,15 @@
/* Initializes a given TrueType face object. */
/* */
/* <Input> */
- /* resource :: The source font resource. */
+ /* stream :: The source font stream. */
+ /* */
/* face_index :: The index of the font face in the resource. */
+ /* */
+ /* num_params :: Number of additional generic parameters. Ignored. */
+ /* */
+ /* params :: Additional generic parameters. Ignored. */
+ /* */
+ /* <InOut> */
/* face :: The newly built face object. */
/* */
/* <Return> */
@@ -70,43 +81,49 @@
TT_Int num_params,
FT_Parameter* params )
{
- TT_Error error;
- FT_Driver sfnt_driver;
- SFNT_Interface* sfnt;
+ TT_Error error;
+ FT_Driver sfnt_driver;
+ SFNT_Interface* sfnt;
+
sfnt_driver = FT_Get_Driver( face->root.driver->library, "sfnt" );
- if (!sfnt_driver) goto Bad_Format;
+ if ( !sfnt_driver )
+ goto Bad_Format;
sfnt = (SFNT_Interface*)(sfnt_driver->interface.format_interface);
- if (!sfnt) goto Bad_Format;
+ if ( !sfnt )
+ goto Bad_Format;
/* create input stream from resource */
- if ( FILE_Seek(0) )
+ if ( FILE_Seek( 0 ) )
goto Exit;
/* check that we have a valid TrueType file */
error = sfnt->init_face( stream, face, face_index, num_params, params );
- if (error) goto Exit;
+ if ( error )
+ goto Exit;
/* We must also be able to accept Mac/GX fonts, as well as OT ones */
- if ( face->format_tag != 0x00010000 && /* MS fonts */
- face->format_tag != TTAG_true ) /* Mac fonts */
+ if ( face->format_tag != 0x00010000L && /* MS fonts */
+ face->format_tag != TTAG_true ) /* Mac fonts */
{
- FT_TRACE2(( "[not a valid TTF font]" ));
+ FT_TRACE2(( "[not a valid TTF font]\n" ));
goto Bad_Format;
}
- /* If we're performing a simple font format check, exit immediately */
+ /* If we are performing a simple font format check, exit immediately */
if ( face_index < 0 )
return TT_Err_Ok;
/* Load font directory */
error = sfnt->load_face( stream, face, face_index, num_params, params );
- if ( error ) goto Exit;
+ if ( error )
+ goto Exit;
error = TT_Load_Locations( face, stream ) ||
TT_Load_CVT ( face, stream ) ||
TT_Load_Programs ( face, stream );
+
Exit:
return error;
@@ -136,8 +153,9 @@
SFNT_Interface* sfnt = face->sfnt;
- if (sfnt)
- sfnt->done_face(face);
+
+ if ( sfnt )
+ sfnt->done_face( face );
/* freeing the locations table */
FREE( face->glyph_locations );
@@ -182,6 +200,7 @@
TT_Error error = 0;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
TT_Face face = (TT_Face)size->root.face;
FT_Memory memory = face->root.memory;
TT_Int i;
@@ -190,6 +209,7 @@
TT_UShort n_twilight;
TT_MaxProfile* maxp = &face->max_profile;
+
size->ttmetrics.valid = FALSE;
size->max_function_defs = maxp->maxFunctionDefs;
@@ -209,6 +229,7 @@
FT_Size_Metrics* metrics = &size->root.metrics;
TT_Size_Metrics* metrics2 = &size->ttmetrics;
+
metrics->x_ppem = 0;
metrics->y_ppem = 0;
@@ -220,7 +241,7 @@
metrics2->compensations[i] = 0;
}
- /* allocate function defs, instruction defs, cvt and storage area */
+ /* allocate function defs, instruction defs, cvt, and storage area */
if ( ALLOC_ARRAY( size->function_defs,
size->max_function_defs,
TT_DefRecord ) ||
@@ -249,17 +270,18 @@
{
FT_Library library = face->root.driver->library;
+
face->interpreter = (TT_Interpreter)
- library->debug_hooks[ FT_DEBUG_HOOK_TRUETYPE ];
- if (!face->interpreter)
+ library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
+ if ( !face->interpreter )
face->interpreter = (TT_Interpreter)TT_RunIns;
}
/* Fine, now execute the font program! */
exec = size->context;
- if (!size->debug)
- exec = TT_New_Context( face );
/* size objects used during debugging have their own context */
+ if ( !size->debug )
+ exec = TT_New_Context( face );
if ( !exec )
{
@@ -282,14 +304,14 @@
TT_Size_Metrics* tt_metrics = &exec->tt_metrics;
- metrics->x_ppem = 0;
- metrics->y_ppem = 0;
- metrics->x_scale = 0;
- metrics->y_scale = 0;
+ metrics->x_ppem = 0;
+ metrics->y_ppem = 0;
+ metrics->x_scale = 0;
+ metrics->y_scale = 0;
- tt_metrics->ppem = 0;
- tt_metrics->scale = 0;
- tt_metrics->ratio = 0x10000;
+ tt_metrics->ppem = 0;
+ tt_metrics->scale = 0;
+ tt_metrics->ratio = 0x10000L;
}
exec->instruction_trap = FALSE;
@@ -332,11 +354,13 @@
return error;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
Fail_Exec:
if ( !size->debug )
TT_Done_Context( exec );
Fail_Memory:
+
#endif
TT_Done_Size( size );
@@ -358,9 +382,12 @@
LOCAL_FUNC
void TT_Done_Size( TT_Size size )
{
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
FT_Memory memory = size->root.face->memory;
+
if ( size->debug )
{
/* the debug context must be deleted by the debugger itself */
@@ -380,6 +407,7 @@
FREE( size->function_defs );
FREE( size->instruction_defs );
+
size->num_function_defs = 0;
size->max_function_defs = 0;
size->num_instruction_defs = 0;
@@ -387,6 +415,7 @@
size->max_func = 0;
size->max_ins = 0;
+
#endif
size->ttmetrics.valid = FALSE;
@@ -413,6 +442,7 @@
FT_Size_Metrics* metrics;
+
if ( size->ttmetrics.valid )
return TT_Err_Ok;
@@ -428,7 +458,7 @@
{
size->ttmetrics.scale = metrics->x_scale;
size->ttmetrics.ppem = metrics->x_ppem;
- size->ttmetrics.x_ratio = 0x10000;
+ size->ttmetrics.x_ratio = 0x10000L;
size->ttmetrics.y_ratio = FT_MulDiv( metrics->y_ppem,
0x10000L,
metrics->x_ppem );
@@ -440,7 +470,7 @@
size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem,
0x10000L,
metrics->y_ppem );
- size->ttmetrics.y_ratio = 0x10000;
+ size->ttmetrics.y_ratio = 0x10000L;
}
/* Compute root ascender, descender, test height, and max_advance */
@@ -457,13 +487,14 @@
metrics->x_scale ) + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
{
TT_ExecContext exec;
TT_UInt i, j;
+
/* Scale the cvt values to the new ppem. */
/* We use by default the y ppem to scale the CVT. */
-
for ( i = 0; i < size->cvt_size; i++ )
size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
@@ -528,6 +559,7 @@
TT_Done_Context( exec );
/* debugging instances keep their context */
}
+
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
if ( !error )
@@ -559,7 +591,7 @@
FT_Library library = face->driver->library;
- FT_TRACE4(( "TT.Init_GlyphSlot: Creating outline maxp = %d, maxc = %d\n",
+ FT_TRACE4(( "TT_Init_GlyphSlot: Creating outline maxp = %d, maxc = %d\n",
face->max_points, face->max_contours ));
return FT_Outline_New( library,
@@ -586,7 +618,8 @@
FT_Library library = slot->face->driver->library;
FT_Memory memory = library->memory;
- if (slot->flags & ft_glyph_own_bitmap)
+
+ if ( slot->flags & ft_glyph_own_bitmap )
FREE( slot->bitmap.buffer );
FT_Outline_Done( library, &slot->outline );
@@ -614,10 +647,13 @@
FT_Memory memory = driver->root.memory;
FT_Error error;
+
error = FT_New_GlyphZone( memory, 0, 0, &driver->zone );
- if (error) return error;
+ if ( error )
+ return error;
/* init extension registry if needed */
+
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
return TT_Init_Extensions( driver );
#else
@@ -641,6 +677,7 @@
void TT_Done_Driver( TT_Driver driver )
{
/* destroy extensions registry if needed */
+
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
TT_Done_Extensions( driver );
#endif
@@ -649,12 +686,14 @@
FT_Done_GlyphZone( &driver->zone );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
/* destroy the execution context */
if ( driver->context )
{
TT_Destroy_Context( driver->context, driver->root.memory );
driver->context = NULL;
}
+
#endif
}
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 220e706..56459e2 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -4,11 +4,11 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -209,7 +209,7 @@
/* */
/* A note regarding non-squared pixels: */
/* */
- /* (This text will probably go into some docs at some time, for now, it */
+ /* (This text will probably go into some docs at some time; for now, it */
/* is kept here to explain some definitions in the TIns_Metrics */
/* record). */
/* */
@@ -312,6 +312,7 @@
TT_Size_Metrics ttmetrics;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
TT_UInt num_function_defs; /* number of function definitions */
TT_UInt max_function_defs;
TT_DefArray function_defs; /* table of function definitions */
@@ -364,45 +365,60 @@
} TT_DriverRec;
- /*************************************************************************/
- /* Face Funcs */
-
- LOCAL_DEF TT_Error TT_Init_Face( FT_Stream stream,
- TT_Face face,
- TT_Int face_index,
- TT_Int num_params,
- FT_Parameter* params );
+ /*************************************************************************/
+ /* */
+ /* Face functions */
+ /* */
+ LOCAL_DEF
+ TT_Error TT_Init_Face( FT_Stream stream,
+ TT_Face face,
+ TT_Int face_index,
+ TT_Int num_params,
+ FT_Parameter* params );
- LOCAL_DEF void TT_Done_Face( TT_Face face );
+ LOCAL_DEF
+ void TT_Done_Face( TT_Face face );
- /*************************************************************************/
- /* Size funcs */
+ /*************************************************************************/
+ /* */
+ /* Size functions */
+ /* */
+ LOCAL_DEF
+ TT_Error TT_Init_Size( TT_Size size );
- LOCAL_DEF TT_Error TT_Init_Size ( TT_Size size );
- LOCAL_DEF void TT_Done_Size ( TT_Size size );
- LOCAL_DEF TT_Error TT_Reset_Size( TT_Size size );
+ LOCAL_DEF
+ void TT_Done_Size( TT_Size size );
+ LOCAL_DEF
+ TT_Error TT_Reset_Size( TT_Size size );
- /*************************************************************************/
- /* GlyphSlot funcs */
- LOCAL_DEF TT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot );
- LOCAL_DEF void TT_Done_GlyphSlot( TT_GlyphSlot slot );
+ /*************************************************************************/
+ /* */
+ /* GlyphSlot functions */
+ /* */
+ LOCAL_DEF
+ TT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot );
+ LOCAL_DEF
+ void TT_Done_GlyphSlot( TT_GlyphSlot slot );
- /*************************************************************************/
- /* Driver funcs */
- LOCAL_DEF TT_Error TT_Init_Driver( TT_Driver driver );
- LOCAL_DEF void TT_Done_Driver( TT_Driver driver );
+ /*************************************************************************/
+ /* */
+ /* Driver functions */
+ /* */
+ LOCAL_DEF
+ TT_Error TT_Init_Driver( TT_Driver driver );
+ LOCAL_DEF
+ void TT_Done_Driver( TT_Driver driver );
#ifdef __cplusplus
}
#endif
-
#endif /* TTOBJS_H */
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index e2b4e48..5789e86 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (body). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -24,8 +24,16 @@
#include <ttpload.h>
#include <freetype/internal/tterrors.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttload
+#define FT_COMPONENT trace_ttpload
+
/*************************************************************************/
/* */
@@ -35,8 +43,10 @@
/* <Description> */
/* Loads the locations table. */
/* */
- /* <Input> */
+ /* <InOut> */
/* face :: A handle to the target face object. */
+ /* */
+ /* <Input> */
/* stream :: The input stream. */
/* */
/* <Return> */
@@ -51,11 +61,12 @@
TT_Short LongOffsets;
TT_ULong table_len;
+
FT_TRACE2(( "Locations " ));
LongOffsets = face->header.Index_To_Loc_Format;
error = face->goto_table( face, TTAG_loca, stream, &table_len );
- if (error)
+ if ( error )
{
error = TT_Err_Locations_Missing;
goto Exit;
@@ -63,9 +74,9 @@
if ( LongOffsets != 0 )
{
- face->num_locations = (TT_UShort)(table_len >> 2);
+ face->num_locations = (TT_UShort)( table_len >> 2 );
- FT_TRACE2(( "(32 bits offsets): %12d ", face->num_locations ));
+ FT_TRACE2(( "(32bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations,
@@ -79,6 +90,7 @@
TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations;
+
for ( ; loc < limit; loc++ )
*loc = GET_Long();
}
@@ -87,10 +99,9 @@
}
else
{
- face->num_locations = (TT_UShort)(table_len >> 1);
+ face->num_locations = (TT_UShort)( table_len >> 1 );
- FT_TRACE2(( "(16 bits offsets): %12d ",
- face->num_locations ));
+ FT_TRACE2(( "(16bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations,
@@ -103,8 +114,9 @@
TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations;
+
for ( ; loc < limit; loc++ )
- *loc = (TT_Long)((TT_ULong)GET_UShort() * 2);
+ *loc = (TT_Long)( (TT_ULong)GET_UShort() * 2 );
}
FORGET_Frame();
}
@@ -124,8 +136,10 @@
/* <Description> */
/* Loads the control value table into a face object. */
/* */
- /* <Input> */
+ /* <InOut> */
/* face :: A handle to the target face object. */
+ /* */
+ /* <Input> */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
@@ -139,10 +153,11 @@
FT_Memory memory = stream->memory;
TT_ULong table_len;
+
FT_TRACE2(( "CVT " ));
error = face->goto_table( face, TTAG_cvt, stream, &table_len );
- if (error)
+ if ( error )
{
FT_TRACE2(( "is missing!\n" ));
@@ -167,6 +182,7 @@
TT_Short* cur = face->cvt;
TT_Short* limit = cur + face->cvt_size;
+
for ( ; cur < limit; cur++ )
*cur = GET_Short();
}
@@ -187,8 +203,10 @@
/* <Description> */
/* Loads the font program and the cvt program. */
/* */
- /* <Input> */
+ /* <InOut> */
/* face :: A handle to the target face object. */
+ /* */
+ /* <Input> */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
@@ -201,6 +219,7 @@
TT_Error error;
TT_ULong table_len;
+
FT_TRACE2(( "Font program " ));
/* The font program is optional */
@@ -209,6 +228,7 @@
{
face->font_program = NULL;
face->font_program_size = 0;
+
FT_TRACE2(( "is missing!\n" ));
}
else
@@ -236,6 +256,7 @@
face->cvt_program_size = table_len;
if ( EXTRACT_Frame( table_len, face->cvt_program ) )
goto Exit;
+
FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
}
diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h
index 30b2972..4e44b38 100644
--- a/src/truetype/ttpload.h
+++ b/src/truetype/ttpload.h
@@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (specification). */
/* */
-/* Copyright 1996-1999 by */
+/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
@@ -27,61 +27,14 @@
#endif
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Locations */
- /* */
- /* <Description> */
- /* Loads the locations table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Load_Locations( TT_Face face,
FT_Stream stream );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_CVT */
- /* */
- /* <Description> */
- /* Loads the control value table into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Load_CVT( TT_Face face,
FT_Stream stream );
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Progams */
- /* */
- /* <Description> */
- /* Loads the font program and the cvt program. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
LOCAL_DEF
TT_Error TT_Load_Programs( TT_Face face,
FT_Stream stream );
diff --git a/src/type1/rules.mk b/src/type1/rules.mk
index d35997c..6b71841 100644
--- a/src/type1/rules.mk
+++ b/src/type1/rules.mk
@@ -1,85 +1,16 @@
-#****************************************************************************
-#* *
-#* Type1 driver Makefile *
-#* *
-#* Copyright 1996-1999 by *
-#* David Turner, Robert Wilhelm, and Werner Lemberg. *
-#* *
-#* This file is part of the FreeType project, and may only be used *
-#* modified and distributed under the terms of the FreeType project *
-#* license, LICENSE.TXT. By continuing to use, modify, or distribute *
-#* this file you indicate that you have read the license and *
-#* understand and accept it fully. *
-#* *
-#****************************************************************************
-
-
-#****************************************************************************
-#* *
-#* IMPORTANT NOTE: This Makefile is intended for GNU Make! *
-#* If you provide Makefiles for other make utilities, *
-#* please place them in `freetype/lib/arch/<system>'. *
-#* *
-#* *
-#* This file is to be included by the FreeType Makefile.lib, located in *
-#* the `freetype/lib' directory. Here is the list of the variables that *
-#* must be defined to use it: *
-#* *
-#* *
-#* BASE_DIR: The location of the base layer's directory. This is *
-#* usually `freetype/lib/base'. *
-#* *
-#* ARCH_DIR: The location of the architecture-dependent directory. *
-#* This is usually `freetype/lib/arch/<system>'. *
-#* *
-#* DRIVERS_DIR: The location of the font driver sub-dirs, usually *
-#* `freetype/lib/drivers'. *
-#* *
-#* OBJ_DIR: The location where the compiled object(s) file will be *
-#* placed. *
-#* *
-#* BASE_H: A list of pathnames to the base layer's header files on *
-#* which the driver depends. *
-#* *
-#* FT_CFLAGS: A set of flags used for compilation of object files. *
-#* This contains at least the include paths of the arch *
-#* and base directories + optimization + warnings + ANSI *
-#* compliance. *
-#* *
-#* FT_IFLAG: The flag used to specify an include path on the *
-#* compiler command line. For example, with GCC, this is *
-#* `-I', while some other compilers use `/i=' or `-J', *
-#* etc. *
-#* *
-#* FT_OBJ: The suffix of an object file for the platform; can be *
-#* `o', `obj', `coff', `tco', etc. depending on the *
-#* platform. *
-#* *
-#* *
-#* It also updates the following variables defined and used in the main *
-#* Makefile: *
-#* *
-#* DRV_OBJ_S: The list of driver object files in *
-#* single-object mode. *
-#* *
-#* DRV_OBJ_M: The list of driver object files in *
-#* multiple-objects mode. *
-#* *
-#* FTINIT_DRIVER_PATHS: The list of include paths used to compile the *
-#* `ftinit' component which registers all font *
-#* drivers in the FT_Init_FreeType() function. *
-#* *
-#* FTINIT_DRIVER_H: The list of header dependencies used to *
-#* compile the `ftinit' component. *
-#* *
-#* FTINIT_DRIVER_MACROS: The list of macros to be defined when *
-#* compiling the `ftinit' component. *
-#* *
-#* `Single-object compilation' means that each font driver is compiled *
-#* into a single object file. This is useful to get rid of all *
-#* driver-specific entries. *
-#* *
-#****************************************************************************
+#
+# FreeType 2 Type 1 driver configuration rules
+#
+
+
+# Copyright 1996-2000 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT. By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
# Type1 driver directory
@@ -90,62 +21,52 @@ T1_DIR_ := $(T1_DIR)$(SEP)
# additional include flags used when compiling the driver
#
-T1_INCLUDE := $(SHARED) $(T1_DIR)
-T1_COMPILE := $(FT_COMPILE) $(T1_INCLUDE:%=$I%)
+T1_INCLUDE := $(T1_DIR)
+
+# compilation flags for the driver
+#
+T1_CFLAGS := $(T1_INCLUDE:%=$I%)
+T1_COMPILE := $(FT_COMPILE) $(T1_CFLAGS)
# Type1 driver sources (i.e., C files)
#
-T1_DRV_SRC := $(T1_DIR_)t1objs.c \
- $(T1_DIR_)t1load.c \
- $(T1_DIR_)t1parse.c \
- $(T1_DIR_)t1tokens.c \
- $(T1_DIR_)t1driver.c \
- $(T1_DIR_)t1hinter.c \
- $(T1_DIR_)t1afm.c \
+T1_DRV_SRC := $(T1_DIR_)t1objs.c \
+ $(T1_DIR_)t1load.c \
+ $(T1_DIR_)t1parse.c \
+ $(T1_DIR_)t1tokens.c \
+ $(T1_DIR_)t1driver.c \
+ $(T1_DIR_)t1hinter.c \
+ $(T1_DIR_)t1afm.c \
$(T1_DIR_)t1gload.c
-
# Type1 driver headers
#
-T1_DRV_H := $(T1SHARED_H) \
- $(T1_DRV_SRC:%.c=%.h)
+T1_DRV_H := $(T1_DRV_SRC:%.c=%.h)
-# driver object(s)
+# Type1 driver object(s)
#
-# T1_DRV_OBJ_M is used during `debug' builds
-# T1_DRV_OBJ_S is used during `release' builds
+# T1_DRV_OBJ_M is used during `multi' builds
+# T1_DRV_OBJ_S is used during `single' builds
#
-T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O) \
- $(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
+T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_S := $(OBJ_)type1.$O
-
-
-# driver root source file(s)
+# Type1 driver source file for single build
#
-T1_DRV_SRC_M := $(T1_DRV_SRC) $(T1SHARED_SRC)
T1_DRV_SRC_S := $(T1_DIR_)type1.c
-# driver - single object
+# Type1 driver - single object
#
-# the driver is recompiled if any of the header or source files is changed
-#
-$(T1_DRV_OBJ_S): $(BASE_H) $(T1_DRV_H) $(T1_DRV_SRC) $(T1_DRV_SRC_S)
+$(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $(T1_DRV_SRC_S)
-
-# driver - multiple objects
+# Type1 driver - multiple objects
#
-# All objects are recompiled if any of the header files is changed
-#
-$(OBJ_)t1%.$O: $(T1_DIR_)t1%.c $(BASE_H) $(T1_DRV_H)
- $(T1_COMPILE) $T$@ $<
-
-$(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
+$(OBJ_)%.$O: $(T1_DIR_)%.c $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $<
@@ -154,4 +75,4 @@ $(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
DRV_OBJS_S += $(T1_DRV_OBJ_S)
DRV_OBJS_M += $(T1_DRV_OBJ_M)
-# END
+# EOF
diff --git a/src/type1z/rules.mk b/src/type1z/rules.mk
index 07903ca..d470a8b 100644
--- a/src/type1z/rules.mk
+++ b/src/type1z/rules.mk
@@ -1,31 +1,18 @@
#
-# FreeType 2 driver configuration rules
+# FreeType 2 Type1z driver configuration rules
#
# Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
-# This file is part of the FreeType project, and may only be used modified
+# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
-#****************************************************************************
-#* *
-#* The "Type1z" driver is an experimental replacement for the current *
-#* Type 1 driver. It features a very different loading mechanism that *
-#* is much faster than the one used by the `normal' driver, and also *
-#* deals nicely with nearly broken Type 1 font files. It is also *
-#* much smaller... *
-#* *
-#* Note that it may become a permanent replacement of the current *
-#* "src/type1" driver in the future.. *
-#* *
-#****************************************************************************
-
# Type1z driver directory
#
T1Z_DIR := $(SRC_)type1z
@@ -35,7 +22,11 @@ T1Z_DIR_ := $(T1Z_DIR)$(SEP)
# additional include flags used when compiling the driver
#
T1Z_INCLUDE := $(SHARED) $(T1Z_DIR)
-T1Z_COMPILE := $(FT_COMPILE) $(T1Z_INCLUDE:%=$I%)
+
+# compilation flags for the driver
+#
+T1Z_CFLAGS := $(T1Z_INCLUDE:%=$I%)
+T1Z_COMPILE := $(FT_COMPILE) $(T1Z_CFLAGS)
# Type1 driver sources (i.e., C files)
@@ -44,46 +35,37 @@ T1Z_DRV_SRC := $(T1Z_DIR_)t1parse.c \
$(T1Z_DIR_)t1load.c \
$(T1Z_DIR_)t1driver.c \
$(T1Z_DIR_)t1afm.c \
- $(T1Z_DIR_)t1gload.c
+ $(T1Z_DIR_)t1gload.c \
+ $(T1Z_DIR_)t1objs.c
# Type1 driver headers
#
-T1Z_DRV_H := $(T1SHARED_H) \
- $(T1Z_DRV_SRC:%.c=%.h)
+T1Z_DRV_H := $(T1Z_DRV_SRC:%.c=%.h) \
+ $(T1Z_DIR_)t1tokens.h
-# driver object(s)
+# Type1z driver object(s)
#
-# T1Z_DRV_OBJ_M is used during `debug' builds
-# T1Z_DRV_OBJ_S is used during `release' builds
+# T1Z_DRV_OBJ_M is used during `multi' builds
+# T1Z_DRV_OBJ_S is used during `single' builds
#
-T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O) \
- $(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
+T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O)
T1Z_DRV_OBJ_S := $(OBJ_)type1z.$O
-
-# driver source file(s)
+# Type1z driver source file for single build
#
-T1Z_DRV_SRC_M := $(T1Z_DRV_SRC) $(T1SHARED_SRC)
T1Z_DRV_SRC_S := $(T1Z_DIR_)type1z.c
-# driver - single object
+# Type1z driver - single object
#
-# the driver is recompiled if any of the header or source files is changed
-#
-$(T1Z_DRV_OBJ_S): $(BASE_H) $(T1Z_DRV_H) $(T1Z_DRV_SRC) $(T1Z_DRV_SRC_S)
+$(T1Z_DRV_OBJ_S): $(T1Z_DRV_SRC_S) $(T1Z_DRV_SRC) $(FREETYPE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $(T1Z_DRV_SRC_S)
-# driver - multiple objects
-#
-# All objects are recompiled if any of the header files is changed
+# Type1z driver - multiple objects
#
-$(OBJ_)t1%.$O: $(T1Z_DIR_)t1%.c $(BASE_H) $(T1Z_DRV_H)
- $(T1Z_COMPILE) $T$@ $<
-
-$(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
+$(OBJ_)%.$O: $(T1Z_DIR_)%.c $(FREETYPE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $<