Formatting. Fixing some tracing messages.
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
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index fbc460d..6334d64 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -117,7 +117,7 @@
while ( p < limit && !isdigit( *p ) )
{
sign = 1;
- if (*p == '-')
+ if ( *p == '-' )
sign = -1;
p++;
@@ -248,7 +248,7 @@
FT_Vector* kerning )
{
T1_Kern_Pair *min, *mid, *max;
- FT_ULong index = KERN_INDEX( glyph1, glyph2 );
+ FT_ULong index = KERN_INDEX( glyph1, glyph2 );
/* simple binary search */
@@ -260,8 +260,9 @@
FT_ULong midi;
- mid = min + ( max - min ) / 2;
+ mid = min + ( max - min ) / 2;
midi = KERN_INDEX( mid->glyph1, mid->glyph2 );
+
if ( midi == index )
{
*kerning = mid->kerning;
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 64b606d..76ab375 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -172,6 +172,7 @@
return T1_Reset_Size( size );
}
+
/*************************************************************************/
/* */
/* <Function> */
@@ -195,7 +196,8 @@
FT_UInt result = 0;
PSNames_Interface* psnames;
- face = (T1_Face)charmap->face;
+
+ face = (T1_Face)charmap->face;
psnames = (PSNames_Interface*)face->psnames;
if ( psnames )
switch ( charmap->encoding )
@@ -205,7 +207,7 @@
/* Unicode encoding support */
/* */
case ft_encoding_unicode:
- /* use the `psnames' module to synthetize the Unicode charmap */
+ /* use the `PSNames' module to synthetize the Unicode charmap */
result = psnames->lookup_unicode( &face->unicode_map,
(FT_ULong)charcode );
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 1b86b3f..82f454b 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -241,17 +241,17 @@
/* Implements the `seac' Type 1 operator for a Type 1 decoder. */
/* */
/* <Input> */
- /* decoder :: The current CID decoder. */
+ /* decoder :: The current CID decoder. */
/* */
- /* asb :: The accent's side bearing. */
+ /* asb :: The accent's side bearing. */
/* */
- /* adx :: The horizontal offset of the accent. */
+ /* adx :: The horizontal offset of the accent. */
/* */
- /* ady :: The vertical offset of the accent. */
+ /* ady :: The vertical offset of the accent. */
/* */
- /* bchar :: The base character's StandardEncoding charcode. */
+ /* bchar :: The base character's StandardEncoding charcode. */
/* */
- /* achar :: The accent character's StandardEncoding charcode. */
+ /* achar :: The accent character's StandardEncoding charcode. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -278,7 +278,8 @@
if ( bchar_index < 0 || achar_index < 0 )
{
- FT_ERROR(( "t1operator_seac: invalid seac character code arguments\n" ));
+ FT_ERROR(( "t1operator_seac:" ));
+ FT_ERROR(( " invalid seac character code arguments\n" ));
return T1_Err_Syntax_Error;
}
@@ -371,6 +372,7 @@
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
+
FT_Outline_Translate( &dummy, adx - asb, ady );
}
@@ -450,17 +452,17 @@
/* Parses a given Type 1 charstrings program. */
/* */
/* <Input> */
- /* decoder :: The current Type 1 decoder. */
+ /* decoder :: The current Type 1 decoder. */
/* */
- /* charstring_base :: The base address of the charstring stream. */
+ /* charstring_base :: The base address of the charstring stream. */
/* */
- /* charstring_len :: The length in bytes of the charstring stream. */
+ /* charstring_len :: The length in bytes of the charstring stream. */
/* */
- /* num_subrs :: The number of sub-routines. */
+ /* num_subrs :: The number of sub-routines. */
/* */
- /* subrs_base :: An array of sub-routines addresses. */
+ /* subrs_base :: An array of sub-routines addresses. */
/* */
- /* subrs_len :: An array of sub-routines lengths. */
+ /* subrs_len :: An array of sub-routines lengths. */
/* */
/* <Return> */
/* Free error code. 0 means success. */
@@ -481,7 +483,8 @@
T1_Builder_Funcs* builds = &builder->funcs;
T1_Hinter_Funcs* hints = &decoder->hinter;
- static const FT_Int args_count[op_max] =
+ static
+ const FT_Int args_count[op_max] =
{
0, /* none */
0, /* endchar */
@@ -528,9 +531,9 @@
/* now, execute loop */
while ( ip < limit )
{
- FT_Int* top = decoder->top;
- T1_Operator op = op_none;
- FT_Long value = 0;
+ FT_Int* top = decoder->top;
+ T1_Operator op = op_none;
+ FT_Long value = 0;
/* Start with the decompression of operator or value */
@@ -656,7 +659,8 @@
{
if ( ++ip > limit )
{
- FT_ERROR(( "T1_Parse_CharStrings: unexpected EOF in integer\n" ));
+ FT_ERROR(( "T1_Parse_CharStrings:" ));
+ FT_ERROR(( " unexpected EOF in integer\n" ));
goto Syntax_Error;
}
@@ -674,7 +678,7 @@
}
}
- /* push value if needed */
+ /* push value if necessary */
if ( op == op_none )
{
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
@@ -775,10 +779,10 @@
goto Syntax_Error;
}
- if (ip[0] != 12 || ip[1] != 17)
+ if ( ip[0] != 12 || ip[1] != 17 )
{
- FT_ERROR(( "T1_Parse_CharStrings: `pop' expected, found (%d %d)\n",
- ip[0], ip[1] ));
+ FT_ERROR(( "T1_Parse_CharStrings:" ));
+ FT_ERROR(( " `pop' expected, found (%d %d)\n", ip[0], ip[1] ));
goto Syntax_Error;
}
@@ -966,7 +970,8 @@
break;
case op_setcurrentpoint:
- FT_ERROR(( "T1_Parse_CharStrings: unexpected `setcurrentpoint'\n" ));
+ FT_ERROR(( "T1_Parse_CharStrings:" ));
+ FT_ERROR(( " unexpected `setcurrentpoint'\n" ));
goto Syntax_Error;
break;
@@ -1224,6 +1229,7 @@
*point++ = *source_point--;
*tags++ = *source_tags--;
num_points--;
+
} while ( num_points > 0 );
}
@@ -1237,6 +1243,7 @@
{
FT_Outline* cur = builder->current;
+
/* XXXX: We must not include the last point in the path if it */
/* is located on the first point. */
if ( cur->n_points > 1 )
@@ -1261,7 +1268,7 @@
cur->contours[cur->n_contours - 1] = cur->n_points - 1;
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
- /* hint latest points if needed -- this is not strictly required */
+ /* hint last points if necessary -- this is not strictly required */
/* there, but it helps for debugging, and doesn't affect performance */
if ( builder->pass == 1 )
T1_Hint_Points( builder );
@@ -1275,7 +1282,7 @@
static
FT_Error gload_endchar( T1_Builder* builder )
{
- FT_Error error;
+ FT_Error error;
/* close path if needed */
@@ -1526,7 +1533,7 @@
FT_Error error;
- /* Pass 1 - try to load first glyph, simply recording points */
+ /* Pass 1 -- try to load first glyph, simply recording points */
old_points = loader->base.outline.n_points;
old_contours = loader->base.outline.n_contours;
@@ -1611,11 +1618,11 @@
builder->base->n_points = old_points;
builder->base->n_contours = old_contours;
- /* Pass 2 - record and scale/hint the points */
+ /* Pass 2 -- record and scale/hint the points */
T1_Reset_Builder( builder, 0 );
- builder->pass = 1;
- builder->no_recurse = 0;
+ builder->pass = 1;
+ builder->no_recurse = 0;
error = T1_Parse_CharStrings( decoder,
type1->charstrings [glyph_index],
@@ -1634,7 +1641,7 @@
}
-#endif /* T1_CONFIG_OPTION_DISABLE_HINTER */
+#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
LOCAL_FUNC
@@ -1677,7 +1684,7 @@
}
else
-#endif /* T1_CONFIG_OPTION_DISABLE_HINTER */
+#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
{
T1_Init_Decoder( &decoder, &gload_hinter_interface );
@@ -1771,6 +1778,7 @@
FT_Fixed x_scale = glyph->x_scale;
FT_Fixed y_scale = glyph->y_scale;
+
/* First of all, scale the points */
for ( n = cur->n_points; n > 0; n--, vec++ )
{
diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h
index fd6a434..71f70af 100644
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -76,7 +76,6 @@
} T1_Builder_Funcs;
-
/*************************************************************************/
/* */
/* <Structure> */
@@ -203,7 +202,6 @@
} T1_Hinter_Funcs;
-
typedef enum T1_Operator_
{
op_none = 0,
diff --git a/src/type1/t1hinter.c b/src/type1/t1hinter.c
index 0ac6c5e..d3b5983 100644
--- a/src/type1/t1hinter.c
+++ b/src/type1/t1hinter.c
@@ -80,6 +80,7 @@
swap = cur[-2]; cur[-2] = cur[0]; cur[0] = swap;
swap = cur[-1]; cur[-1] = cur[1]; cur[1] = swap;
cur -= 2;
+
} while ( cur > blues );
}
}
@@ -658,7 +659,7 @@
max = min;
}
- /* now scan the array. If we find a stem with the same borders */
+ /* Now scan the array. If we find a stem with the same borders */
/* simply activate it. */
cur_stem = stems;
new_stem = 1;
@@ -679,7 +680,7 @@
}
}
- /* add a new stem to the array when necessary */
+ /* add a new stem to the array if necessary */
if ( new_stem )
{
if ( cur_stem >= stems + T1_HINTER_MAX_EDGES )
@@ -701,7 +702,8 @@
}
else
{
- FT_ERROR(( "t1_hinter_stem: fatal glyph loader bug - pass2-stem\n" ));
+ FT_ERROR(( "t1_hinter_stem:" ));
+ FT_ERROR(( " fatal glyph loader bug -- pass2-stem\n" ));
return T1_Err_Syntax_Error;
}
}
@@ -801,10 +803,10 @@
static
void t1_sort_hints( T1_Stem_Table* table )
{
- FT_Int num_stems = table->num_stems;
- FT_Int num_active = 0;
- FT_Int* sort = table->sort;
- T1_Stem_Hint* stems = table->stems;
+ FT_Int num_stems = table->num_stems;
+ FT_Int num_active = 0;
+ FT_Int* sort = table->sort;
+ T1_Stem_Hint* stems = table->stems;
FT_Int n;
@@ -815,7 +817,7 @@
sort[num_active++] = n;
}
- /* now sort the indices. There are usually very few stems, */
+ /* Now sort the indices. There are usually very few stems, */
/* and they are pre-sorted in 90% cases, so we choose a */
/* simple bubble sort (quicksort would be slower). */
for ( n = 1; n < num_active; n++ )
@@ -841,6 +843,7 @@
sort[p ] = sort[p + 1];
sort[p + 1] = swap;
p--;
+
} while ( p >= 0 );
}
@@ -1050,8 +1053,7 @@
break;
default: /* no alignment */
-
- /* XXXX TODO: Add management of controlled stems */
+ /* XXX TODO: Add management of controlled stems */
bottom = ( SCALE( bottom_orus + top_orus ) - width_pix ) / 2;
bottom_pix = ROUND( bottom );
@@ -1150,8 +1152,8 @@
/* now place the snapped and rounded stem */
- /* XXXX TODO: implement controlled stems for the overlapping */
- /* cases */
+ /* XXX TODO: implement controlled stems for the overlapping */
+ /* cases */
left = ( SCALE( stem_left + stem_right ) - width_pix ) / 2;
@@ -1253,8 +1255,6 @@
}
-#if 1
-
/*************************************************************************/
/* */
/* <Function> */
@@ -1333,7 +1333,5 @@
scale_x );
}
-#endif /* 1 */
-
/* END */
diff --git a/src/type1/t1hinter.h b/src/type1/t1hinter.h
index 86739df..db02a53 100644
--- a/src/type1/t1hinter.h
+++ b/src/type1/t1hinter.h
@@ -97,8 +97,8 @@
/* hint_flags :: Some flags describing the stem properties. */
/* */
/* <Note> */
- /* The min and max edges of a ghost stem have the same position, */
- /* even if they are coded in a weird way in the charstrings. */
+ /* The min and max edges of a ghost stem have the same position, even */
+ /* if they are coded in a weird way in the charstrings. */
/* */
typedef struct T1_Stem_Hint_
{
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 2de739d..443f6b5 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1,3 +1,21 @@
+/***************************************************************************/
+/* */
+/* t1load.c */
+/* */
+/* Type 1 font loader (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 <freetype/config/ftconfig.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h>
@@ -7,23 +25,37 @@
#include <stdio.h>
+#include <string.h> /* for strncpy(), strncmp(), strlen() */
+
+ /*************************************************************************/
+ /* */
+ /* 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_t1load
- typedef FT_Error (*T1_Parse_Func)( T1_Parser* parser );
-
-/*************************************************************************/
-/* */
-/* <Function> Init_T1_Parser */
-/* */
-/* <Description> */
-/* Initialise a given parser object to build a given T1_Face */
-/* */
-/* <Input> */
-/* parser :: handle to the newly built parser object */
-/* face :: handle to target T1 face object */
-/* */
+ typedef FT_Error (*T1_Parse_Func)( T1_Parser* parser );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Init_T1_Parser */
+ /* */
+ /* <Description> */
+ /* Initializes a given parser object to build a given T1_Face. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the newly built parser object. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target Type 1 face object. */
+ /* */
+ /* tokenizer :: A handle to the target Type 1 token manager. */
+ /* */
LOCAL_FUNC
void Init_T1_Parser( T1_Parser* parser,
T1_Face face,
@@ -38,35 +70,35 @@
parser->state_index = 0;
parser->state_stack[0] = dict_none;
- parser->encoding_type = t1_encoding_none;
+ parser->encoding_type = t1_encoding_none;
parser->encoding_names = 0;
parser->encoding_offsets = 0;
parser->encoding_lengths = 0;
- parser->dump_tokens = 0;
- face->type1.private_dict.lenIV = 4; /* XXX : is it sure ?? */
+ parser->dump_tokens = 0;
+ face->type1.private_dict.lenIV = 4; /* XXX : is it sure? */
}
-
-/*************************************************************************/
-/* */
-/* <Function> Next_T1_Token */
-/* */
-/* <Description> */
-/* grabs the next significant token from a parser's input stream. */
-/* this function ignores a number of tokens, and translates */
-/* alternate forms into their common ones.. */
-/* */
-/* <Input> */
-/* parser :: handle to source parser */
-/* */
-/* <Output> */
-/* token :: the extracted token descriptor */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Next_T1_Token */
+ /* */
+ /* <Description> */
+ /* Grabs the next significant token from a parser's input stream. */
+ /* This function ignores a number of tokens, and translates */
+ /* alternate forms into their common ones. */
+ /* */
+ /* <Input> */
+ /* parser :: A handle to the source parser. */
+ /* */
+ /* <Output> */
+ /* token :: The extracted token descriptor. */
+ /* */
+ /* <Return> */
+ /* FreeTyoe error code. 0 means success. */
+ /* */
LOCAL_FUNC
FT_Error Next_T1_Token( T1_Parser* parser,
T1_Token* token )
@@ -74,66 +106,71 @@
FT_Error error;
T1_Tokenizer tokzer = parser->tokenizer;
+
L1:
error = Read_Token( tokzer );
- if (error) return error;
+ if ( error )
+ return error;
- /* We now must ignore a number of tokens like "dup", "executeonly", */
- /* "readonly", etc... */
+ /* we now must ignore a number of tokens like `dup', `executeonly', */
+ /* `readonly', etc. */
*token = tokzer->token;
if ( token->kind == tok_keyword )
switch( token->kind2 )
{
- case key_dup:
- case key_execonly:
- case key_readonly:
- case key_noaccess:
- case key_userdict:
- /* do nothing - loop */
- goto L1;
-
- /* We also translate some other keywords from their alternative */
- /* to their "normal" form.. */
-
- case key_NP_alternate:
- token->kind2 = key_NP;
- break;
+ case key_dup:
+ case key_execonly:
+ case key_readonly:
+ case key_noaccess:
+ case key_userdict:
+ /* do nothing - loop */
+ goto L1;
+
+ /* we also translate some other keywords from their alternative */
+ /* to their `normal' form */
+
+ case key_NP_alternate:
+ token->kind2 = key_NP;
+ break;
- case key_RD_alternate:
- token->kind2 = key_RD;
- break;
+ case key_RD_alternate:
+ token->kind2 = key_RD;
+ break;
- case key_ND_alternate:
- token->kind2 = key_ND;
- break;
+ case key_ND_alternate:
+ token->kind2 = key_ND;
+ break;
- default:
- ;
+ default:
+ ;
}
- /* Dump the token when requested. This feature is only available */
- /* in the 'error' and 'trace' debug levels.. */
#if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
+
+ /* Dump the token when requested. This feature is only available */
+ /* in the `error' and `trace' debug levels. */
if ( parser->dump_tokens )
{
FT_String temp_string[128];
FT_Int len;
+
len = token->len;
- if ( len > 127 ) len = 127;
+ if ( len > 127 )
+ len = 127;
strncpy( temp_string,
(FT_String*)tokzer->base + token->start,
len );
temp_string[len] = '\0';
FT_ERROR(( "%s\n", temp_string ));
}
-#endif
+
+#endif /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE */
return T1_Err_Ok;
}
-
static
FT_Error Expect_Keyword( T1_Parser* parser,
T1_TokenType keyword )
@@ -141,15 +178,17 @@
T1_Token token;
FT_Error error;
+
error = Next_T1_Token( parser, &token );
- if (error) goto Exit;
+ if ( error )
+ goto Exit;
if ( token.kind != tok_keyword ||
token.kind2 != keyword )
{
error = T1_Err_Syntax_Error;
- FT_ERROR(( "T1.Parse: keyword '%s' expected.\n",
- t1_keywords[ keyword - key_first_ ] ));
+ FT_ERROR(( "Expect_Keyword: keyword `%s' expected.\n",
+ t1_keywords[keyword - key_first_] ));
}
Exit:
@@ -157,7 +196,6 @@
}
-
static
FT_Error Expect_Keyword2( T1_Parser* parser,
T1_TokenType keyword1,
@@ -166,17 +204,19 @@
T1_Token token;
FT_Error error;
+
error = Next_T1_Token( parser, &token );
- if (error) goto Exit;
+ if ( error )
+ goto Exit;
if ( token.kind != tok_keyword ||
( token.kind2 != keyword1 &&
token.kind2 != keyword2 ) )
{
error = T1_Err_Syntax_Error;
- FT_ERROR(( "T1.Parse: keyword '%s' or '%s' expected.\n",
- t1_keywords[ keyword1 - key_first_ ],
- t1_keywords[ keyword2 - key_first_ ] ));
+ FT_ERROR(( "Expect_Keyword2: keyword `%s' or `%s' expected.\n",
+ t1_keywords[keyword1 - key_first_],
+ t1_keywords[keyword2 - key_first_] ));
}
Exit:
@@ -184,76 +224,77 @@
}
-
static
void Parse_Encoding( T1_Parser* parser )
{
- T1_Token* token = parser->top+1;
- FT_Memory memory = parser->face->root.memory;
- T1_Encoding* encode = &parser->face->type1.encoding;
- FT_Error error = 0;
-
- if (token->kind == tok_keyword &&
- (token->kind2 == key_StandardEncoding ||
- token->kind2 == key_ExpertEncoding ) )
- {
- encode->num_chars = 256;
- encode->code_first = 32;
- encode->code_last = 255;
-
- if ( ALLOC_ARRAY( encode->char_index, 256, FT_Short ) )
- goto Exit;
-
- encode->char_name = 0; /* no need to store glyph names */
-
- /* Now copy the encoding */
- switch (token->kind2)
- {
- case key_ExpertEncoding : parser->encoding_type = t1_encoding_expert;
- default : parser->encoding_type = t1_encoding_standard; break;
- }
- }
- else
- {
- FT_ERROR(( "T1.Parse_Encoding: invalid encoding type\n" ));
- error = T1_Err_Syntax_Error;
- }
-
- Exit:
- parser->error = error;
- }
+ T1_Token* token = parser->top+1;
+ FT_Memory memory = parser->face->root.memory;
+ T1_Encoding* encode = &parser->face->type1.encoding;
+ FT_Error error = 0;
+ if ( token->kind == tok_keyword &&
+ ( token->kind2 == key_StandardEncoding ||
+ token->kind2 == key_ExpertEncoding ) )
+ {
+ encode->num_chars = 256;
+ encode->code_first = 32;
+ encode->code_last = 255;
+ if ( ALLOC_ARRAY( encode->char_index, 256, FT_Short ) )
+ goto Exit;
+ encode->char_name = 0; /* no need to store glyph names */
+ /* Now copy the encoding */
+ switch ( token->kind2 )
+ {
+ case key_ExpertEncoding:
+ parser->encoding_type = t1_encoding_expert;
+ break;
+ default:
+ parser->encoding_type = t1_encoding_standard;
+ break;
+ }
+ }
+ else
+ {
+ FT_ERROR(( "Parse_Encoding: invalid encoding type\n" ));
+ error = T1_Err_Syntax_Error;
+ }
- /**********************************************************************/
- /* */
- /* */
- /* IMPLEMENTATION OF THE "DEF" KEYWORD DEPENDING ON */
- /* CURRENT DICTIONARY STATE */
- /* */
- /* */
- /**********************************************************************/
+ Exit:
+ parser->error = error;
+ }
-/**************************************************************************/
-/* */
-/* <Function> Do_Def_Font */
-/* */
-/* <Description> */
-/* This function performs a 'def' when in the Font dictionary */
-/* Its purpose is to build the T1_Face attributes directly from */
-/* the stream.. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* */
+ /* IMPLEMENTATION OF THE `DEF' KEYWORD DEPENDING ON */
+ /* CURRENT DICTIONARY STATE */
+ /* */
+ /* */
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_Def_Font */
+ /* */
+ /* <Description> */
+ /* This function performs a `def' if in the Font dictionary. Its */
+ /* purpose is to build the T1_Face attributes directly from the */
+ /* stream. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
static
FT_Error Do_Def_Font( T1_Parser* parser )
{
@@ -261,292 +302,288 @@
T1_Face face = parser->face;
T1_Font* type1 = &face->type1;
+
switch ( top[0].kind2 )
{
- case imm_FontName:
- /* in some cases, the /FontName is an immediate like */
- /* /TimesNewRoman. In this case, we simply copy the */
- /* token string (without the /).. */
- if (top[1].kind == tok_immediate)
- {
- FT_Memory memory = parser->tokenizer->memory;
- FT_Error error;
- FT_Int len = top[1].len;
+ case imm_FontName:
+ /* in some cases, the /FontName is an immediate like */
+ /* /TimesNewRoman. In this case, we simply copy the */
+ /* token string (without the /). */
+ if ( top[1].kind == tok_immediate )
+ {
+ FT_Memory memory = parser->tokenizer->memory;
+ FT_Error error;
+ FT_Int len = top[1].len;
- if ( ALLOC( type1->font_name, len+1 ) )
- {
- parser->error = error;
- return error;
- }
- MEM_Copy( type1->font_name,
- parser->tokenizer->base + top[1].start,
- len );
- type1->font_name[len] = '\0';
+ if ( ALLOC( type1->font_name, len + 1 ) )
+ {
+ parser->error = error;
+ return error;
}
- else
- type1->font_name = CopyString( parser );
- break;
- case imm_Encoding:
- Parse_Encoding( parser );
- break;
+ MEM_Copy( type1->font_name,
+ parser->tokenizer->base + top[1].start,
+ len );
+ type1->font_name[len] = '\0';
+ }
+ else
+ type1->font_name = CopyString( parser );
+ break;
- case imm_PaintType:
- type1->paint_type = (FT_Byte)CopyInteger( parser );
- break;
+ case imm_Encoding:
+ Parse_Encoding( parser );
+ break;
- case imm_FontType:
- type1->font_type = (FT_Byte)CopyInteger( parser );
- break;
+ case imm_PaintType:
+ type1->paint_type = (FT_Byte)CopyInteger( parser );
+ break;
- case imm_FontMatrix:
- CopyMatrix( parser, &type1->font_matrix );
- break;
+ case imm_FontType:
+ type1->font_type = (FT_Byte)CopyInteger( parser );
+ break;
- case imm_FontBBox:
- CopyBBox( parser, &type1->font_bbox );
- break;
+ case imm_FontMatrix:
+ CopyMatrix( parser, &type1->font_matrix );
+ break;
- case imm_UniqueID:
- type1->private_dict.unique_id = CopyInteger( parser );
- break;
+ case imm_FontBBox:
+ CopyBBox( parser, &type1->font_bbox );
+ break;
- case imm_StrokeWidth:
- type1->stroke_width = CopyInteger( parser );
- break;
+ case imm_UniqueID:
+ type1->private_dict.unique_id = CopyInteger( parser );
+ break;
- case imm_FontID:
- type1->font_id = CopyInteger( parser );
- break;
+ case imm_StrokeWidth:
+ type1->stroke_width = CopyInteger( parser );
+ break;
- default:
- /* ignore all other things */
- parser->error = T1_Err_Ok;
+ case imm_FontID:
+ type1->font_id = CopyInteger( parser );
+ break;
+
+ default:
+ /* ignore all other things */
+ parser->error = T1_Err_Ok;
}
+
return parser->error;
}
-
-/**************************************************************************/
-/* */
-/* <Function> Do_Def_FontInfo */
-/* */
-/* <Description> */
-/* This function performs a 'def' when in the FontInfo dictionary */
-/* Its purpose is to build the T1_FontInfo structure directly from */
-/* the stream.. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_Def_FontInfo */
+ /* */
+ /* <Description> */
+ /* This function performs a `def' if in the FontInfo dictionary. Its */
+ /* purpose is to build the T1_FontInfo structure directly from the */
+ /* stream. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeTyoe error code. 0 means success. */
+ /* */
static
FT_Error Do_Def_FontInfo( T1_Parser* parser )
{
- T1_Token* top = parser->top;
- T1_FontInfo* info = &parser->face->type1.font_info;
+ T1_Token* top = parser->top;
+ T1_FontInfo* info = &parser->face->type1.font_info;
+
switch ( top[0].kind2 )
{
- case imm_version:
- info->version = CopyString( parser );
- break;
+ case imm_version:
+ info->version = CopyString( parser );
+ break;
- case imm_Notice:
- info->notice = CopyString( parser );
- break;
+ case imm_Notice:
+ info->notice = CopyString( parser );
+ break;
- case imm_FullName:
- info->full_name = CopyString( parser );
- break;
+ case imm_FullName:
+ info->full_name = CopyString( parser );
+ break;
- case imm_FamilyName:
- info->family_name = CopyString( parser );
- break;
+ case imm_FamilyName:
+ info->family_name = CopyString( parser );
+ break;
- case imm_Weight:
- info->weight = CopyString( parser );
- break;
+ case imm_Weight:
+ info->weight = CopyString( parser );
+ break;
- case imm_ItalicAngle:
- info->italic_angle = CopyInteger( parser );
- break;
+ case imm_ItalicAngle:
+ info->italic_angle = CopyInteger( parser );
+ break;
- case imm_isFixedPitch:
- info->is_fixed_pitch = CopyBoolean( parser );
- break;
+ case imm_isFixedPitch:
+ info->is_fixed_pitch = CopyBoolean( parser );
+ break;
- case imm_UnderlinePosition:
- info->underline_position = (FT_Short)CopyInteger( parser );
- break;
+ case imm_UnderlinePosition:
+ info->underline_position = (FT_Short)CopyInteger( parser );
+ break;
- case imm_UnderlineThickness:
- info->underline_thickness = (FT_Short)CopyInteger( parser );
- break;
+ case imm_UnderlineThickness:
+ info->underline_thickness = (FT_Short)CopyInteger( parser );
+ break;
- default:
- /* ignore all other things */
- parser->error = T1_Err_Ok;
+ default:
+ /* ignore all other things */
+ parser->error = T1_Err_Ok;
}
+
return parser->error;
}
-
-/**************************************************************************/
-/* */
-/* <Function> Do_Def_Private */
-/* */
-/* <Description> */
-/* This function performs a 'def' when in the Private dictionary */
-/* Its purpose is to build the T1_Private structure directly from */
-/* the stream.. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_Def_Private */
+ /* */
+ /* <Description> */
+ /* This function performs a `def' if in the Private dictionary. Its */
+ /* purpose is to build the T1_Private structure directly from the */
+ /* stream. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeTyoe error code. 0 means success. */
+ /* */
static
FT_Error Do_Def_Private( T1_Parser* parser )
{
T1_Token* top = parser->top;
T1_Private* priv = &parser->face->type1.private_dict;
+
switch ( top[0].kind2 )
{
- case imm_RD: case imm_RD_alternate: /* Ignore the definitions */
- case imm_ND: case imm_ND_alternate: /* of RD, NP, ND and their */
- case imm_NP: case imm_NP_alternate: /* alternate forms ... */
- parser->error = T1_Err_Ok;
- break;
-
-
- case imm_BlueValues:
- CopyArray( parser, &priv->num_blue_values,
- priv->blue_values, 14 );
- break;
-
-
- case imm_OtherBlues:
- CopyArray( parser, &priv->num_other_blues,
- priv->other_blues, 10 );
- break;
-
-
- case imm_FamilyBlues:
- CopyArray( parser, &priv->num_family_blues,
- priv->family_blues, 14 );
- break;
-
-
- case imm_FamilyOtherBlues:
- CopyArray( parser, &priv->num_family_other_blues,
- priv->family_other_blues, 10 );
- break;
-
-
- case imm_BlueScale:
- priv->blue_scale = CopyFloat( parser, 0x10000 );
- break;
-
-
- case imm_BlueShift:
- priv->blue_shift = CopyInteger( parser );
- break;
-
-
- case imm_BlueFuzz:
- priv->blue_fuzz = CopyInteger( parser );
- break;
-
-
- case imm_StdHW:
- CopyArray( parser, 0, (FT_Short*)&priv->standard_width, 1 );
- break;
-
-
- case imm_StdVW:
- CopyArray( parser, 0, (FT_Short*)&priv->standard_height, 1 );
- break;
-
-
- case imm_StemSnapH:
- CopyArray( parser, &priv->num_snap_widths,
- priv->snap_widths, 12 );
- break;
-
-
- case imm_StemSnapV:
- CopyArray( parser, &priv->num_snap_heights,
- priv->snap_heights, 12 );
- break;
-
-
- case imm_ForceBold:
- priv->force_bold = CopyBoolean( parser );
- break;
-
-
- case imm_LanguageGroup:
- priv->language_group = CopyInteger( parser );
- break;
-
-
- case imm_password:
- priv->password = CopyInteger( parser );
- break;
-
-
- case imm_UniqueID:
- priv->unique_id = CopyInteger( parser );
- break;
-
-
- case imm_lenIV:
- priv->lenIV = CopyInteger( parser );
- break;
-
-
- case imm_MinFeature:
- CopyArray( parser, 0, priv->min_feature, 2 );
- break;
-
-
- default:
- /* ignore all other things */
- parser->error = T1_Err_Ok;
+ /* Ignore the definitions of RD, NP, ND, and their alternate forms */
+ case imm_RD:
+ case imm_RD_alternate:
+ case imm_ND:
+ case imm_ND_alternate:
+ case imm_NP:
+ case imm_NP_alternate:
+ parser->error = T1_Err_Ok;
+ break;
+
+ case imm_BlueValues:
+ CopyArray( parser, &priv->num_blue_values,
+ priv->blue_values, 14 );
+ break;
+
+ case imm_OtherBlues:
+ CopyArray( parser, &priv->num_other_blues,
+ priv->other_blues, 10 );
+ break;
+
+ case imm_FamilyBlues:
+ CopyArray( parser, &priv->num_family_blues,
+ priv->family_blues, 14 );
+ break;
+
+ case imm_FamilyOtherBlues:
+ CopyArray( parser, &priv->num_family_other_blues,
+ priv->family_other_blues, 10 );
+ break;
+
+ case imm_BlueScale:
+ priv->blue_scale = CopyFloat( parser, 0x10000L );
+ break;
+
+ case imm_BlueShift:
+ priv->blue_shift = CopyInteger( parser );
+ break;
+
+ case imm_BlueFuzz:
+ priv->blue_fuzz = CopyInteger( parser );
+ break;
+
+ case imm_StdHW:
+ CopyArray( parser, 0, (FT_Short*)&priv->standard_width, 1 );
+ break;
+
+ case imm_StdVW:
+ CopyArray( parser, 0, (FT_Short*)&priv->standard_height, 1 );
+ break;
+
+ case imm_StemSnapH:
+ CopyArray( parser, &priv->num_snap_widths,
+ priv->snap_widths, 12 );
+ break;
+
+ case imm_StemSnapV:
+ CopyArray( parser, &priv->num_snap_heights,
+ priv->snap_heights, 12 );
+ break;
+
+ case imm_ForceBold:
+ priv->force_bold = CopyBoolean( parser );
+ break;
+
+ case imm_LanguageGroup:
+ priv->language_group = CopyInteger( parser );
+ break;
+
+ case imm_password:
+ priv->password = CopyInteger( parser );
+ break;
+
+ case imm_UniqueID:
+ priv->unique_id = CopyInteger( parser );
+ break;
+
+ case imm_lenIV:
+ priv->lenIV = CopyInteger( parser );
+ break;
+
+ case imm_MinFeature:
+ CopyArray( parser, 0, priv->min_feature, 2 );
+ break;
+
+ default:
+ /* ignore all other things */
+ parser->error = T1_Err_Ok;
}
+
return parser->error;
}
-
-/**************************************************************************/
-/* */
-/* <Function> Do_Def_Error */
-/* */
-/* <Description> */
-/* This function returns a simple syntax error when invoked. It is */
-/* ued for the "def" keyword when in the "encoding", "subrs", */
-/* "othersubrs" and "charstrings" dictionary states.. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_Def_Error */
+ /* */
+ /* <Description> */
+ /* This function returns a simple syntax error when invoked. It is */
+ /* used for the `def' keyword if in the `encoding', `subrs', */
+ /* `othersubrs', and `charstrings' dictionary states. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
static
FT_Error Do_Def_Error( T1_Parser* parser )
{
- FT_ERROR(( "T1.Load : 'def' keyword encountered in bad dictionary/array\n" ));
+ FT_ERROR(( "Do_Def_Error:" ));
+ FT_ERROR(( " `def' keyword encountered in bad dictionary/array\n" ));
+
parser->error = T1_Err_Syntax_Error;
+
return parser->error;
}
@@ -554,12 +591,13 @@
static
FT_Error Do_Def_Ignore( T1_Parser* parser )
{
- UNUSED(parser);
+ UNUSED( parser );
return T1_Err_Ok;
}
+
static
- T1_Parse_Func def_funcs[ dict_max ] =
+ T1_Parse_Func def_funcs[dict_max] =
{
Do_Def_Error,
Do_Def_Font,
@@ -575,30 +613,32 @@
};
- /**********************************************************************/
- /* */
- /* */
- /* IMPLEMENTATION OF THE "PUT" KEYWORD DEPENDING ON */
- /* CURRENT DICTIONARY STATE */
- /* */
- /* */
- /**********************************************************************/
-
-/**************************************************************************/
-/* */
-/* <Function> Do_Put_Encoding */
-/* */
-/* <Description> */
-/* This function performs a 'put' when in the Encoding array */
-/* The glyph name is copied into the T1 recorder, and the charcode */
-/* and glyph name pointer are written into the face object encoding */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* */
+ /* IMPLEMENTATION OF THE `PUT' KEYWORD DEPENDING ON */
+ /* CURRENT DICTIONARY STATE */
+ /* */
+ /* */
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_Put_Encoding */
+ /* */
+ /* <Description> */
+ /* This function performs a `put' if in the Encoding array. The */
+ /* glyph name is copied into the T1 recorder, and the charcode and */
+ /* glyph name pointer are written into the face object encoding. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
static
FT_Error Do_Put_Encoding( T1_Parser* parser )
{
@@ -608,85 +648,94 @@
T1_Encoding* encode = &face->type1.encoding;
FT_Int index;
+
/* record and check the character code */
if ( top[0].kind != tok_number )
{
- FT_TRACE4(( "T1.Parse.put: number expected\n" ));
+ FT_TRACE4(( "Do_Put_Encoding: number expected\n" ));
goto Syntax_Error;
}
index = (FT_Int)CopyInteger( parser );
- if (parser->error) return parser->error;
+ if ( parser->error )
+ return parser->error;
if ( index < 0 || index >= encode->num_chars )
{
- FT_TRACE4(( "T1.Parse.put: invalid character code\n" ));
+ FT_TRACE4(( "Do_Put_Encoding: invalid character code\n" ));
goto Syntax_Error;
}
/* record the immediate name */
if ( top[1].kind != tok_immediate )
{
- FT_TRACE4(( "T1.Parse.put: immediate name expected\n" ));
+ FT_TRACE4(( "Do_Put_Encoding: immediate name expected\n" ));
goto Syntax_Error;
}
- /* if the glyph name is '.notdef', store a NULL char name */
- /* otherwise, record the glyph name.. */
+ /* if the glyph name is `.notdef', store a NULL char name; */
+ /* otherwise, record the glyph name */
if ( top[1].kind == imm_notdef )
{
- parser->table.elements[ index ] = 0;
- parser->table.lengths [ index ] = 0;
+ parser->table.elements[index] = 0;
+ parser->table.lengths [index] = 0;
}
else
{
FT_String temp_name[128];
- T1_Token* token = top+1;
- FT_Int len = token->len-1;
+ T1_Token* token = top + 1;
+ FT_Int len = token->len - 1;
+
/* copy immediate name */
- if (len > 127) len = 127;
- MEM_Copy( temp_name, parser->tokenizer->base + token->start+1, len );
+ if ( len > 127 )
+ len = 127;
+ MEM_Copy( temp_name, parser->tokenizer->base + token->start + 1, len );
temp_name[len] = '\0';
- error = T1_Add_Table( &parser->table, index, (FT_Byte*)temp_name, len+1 );
+ error = T1_Add_Table( &parser->table, index,
+ (FT_Byte*)temp_name, len + 1 );
- /* adjust code_first and code_last */
- if ( index < encode->code_first ) encode->code_first = index;
- if ( index > encode->code_last ) encode->code_last = index;
+ /* adjust code_first and code_last */
+ if ( index < encode->code_first ) encode->code_first = index;
+ if ( index > encode->code_last ) encode->code_last = index;
}
return error;
Syntax_Error:
/* ignore the error, and simply clear the stack */
- FT_TRACE4(( "T1.Put.Encoding: invalid syntax encountered\n" ));
+ FT_TRACE4(( "Do_Put_Encoding: invalid syntax encountered\n" ));
parser->top = parser->stack;
+
return T1_Err_Ok;
}
- /**********************************************************************/
- /* */
- /* */
- /* IMPLEMENTATION OF THE "RD" KEYWORD DEPENDING ON */
- /* CURRENT DICTIONARY STATE */
- /* */
- /* */
- /**********************************************************************/
-
-/**************************************************************************/
-/* */
-/* <Function> Do_RD_Subrs */
-/* */
-/* <Description> */
-/* This function performs a 'RD' when in the Subrs dictionary */
-/* It simply records the array of bytecodes/charstrings corresponding */
-/* to the sub-routine.. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+
+ /*************************************************************************/
+ /* */
+ /* */
+ /* IMPLEMENTATION OF THE "RD" KEYWORD DEPENDING ON */
+ /* CURRENT DICTIONARY STATE */
+ /* */
+ /* */
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_RD_Subrs */
+ /* */
+ /* <Description> */
+ /* This function performs an `RD' if in the Subrs dictionary. It */
+ /* simply records the array of bytecodes/charstrings corresponding to */
+ /* the sub-routine. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
static
FT_Error Do_RD_Subrs( T1_Parser* parser )
{
@@ -696,37 +745,43 @@
T1_Tokenizer tokzer = parser->tokenizer;
FT_Int index, count;
+
/* record and check the character code */
if ( top[0].kind != tok_number ||
top[1].kind != tok_number )
{
- FT_ERROR(( "T1.Parse.put: number expected\n" ));
+ FT_ERROR(( "Do_RD_Subrs: number expected\n" ));
goto Syntax_Error;
}
index = (FT_Int)CopyInteger( parser );
- error = parser->error; if (error) goto Exit;
+ error = parser->error;
+ if ( error )
+ goto Exit;
count = (FT_Int)CopyInteger( parser );
- error = parser->error; if (error) goto Exit;
+ error = parser->error;
+ if ( error )
+ goto Exit;
if ( index < 0 || index >= face->type1.num_subrs )
{
- FT_ERROR(( "T1.Parse.put: invalid character code\n" ));
+ FT_ERROR(( "Do_RD_Subrs: invalid character code\n" ));
goto Syntax_Error;
}
- /* decrypt charstring and skip them */
+ /* decrypt charstring and skip it */
{
FT_Byte* base = tokzer->base + tokzer->cursor;
+
tokzer->cursor += count;
/* some fonts use a value of -1 for lenIV to indicate that */
- /* the charstrings are unencoded.. */
+ /* the charstrings are unencoded. */
/* */
- /* thanks to Tom Kacvinsky for pointing this out.. */
+ /* Thanks to Tom Kacvinsky for pointing this out. */
/* */
- if (face->type1.private_dict.lenIV >= 0)
+ if ( face->type1.private_dict.lenIV >= 0 )
{
t1_decrypt( base, count, 4330 );
@@ -737,7 +792,7 @@
error = T1_Add_Table( &parser->table, index, base, count );
}
- /* consume the closing NP or 'put' */
+ /* consume the closing NP or `put' */
error = Expect_Keyword2( parser, key_NP, key_put );
Exit:
@@ -748,21 +803,22 @@
}
-/**************************************************************************/
-/* */
-/* <Function> Do_RD_CharStrings */
-/* */
-/* <Description> */
-/* This function performs a 'RD' when in the CharStrings dictionary */
-/* It simply records the array of bytecodes/charstrings corresponding */
-/* to the glyph program string. */
-/* */
-/* <Input> */
-/* parser :: handle to current parser. */
-/* */
-/* <Return> */
-/* Error code. 0 means success */
-/* */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Do_RD_CharStrings */
+ /* */
+ /* <Description> */
+ /* This function performs an `RD' if in the CharStrings dictionary. */
+ /* It simply records the array of bytecodes/charstrings corresponding */
+ /* to the glyph program string. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the current parser. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
static
FT_Error Do_RD_Charstrings( T1_Parser* parser )
{
@@ -772,22 +828,26 @@
T1_Tokenizer tokzer = parser->tokenizer;
FT_Int index, count;
+
/* check the character name argument */
if ( top[0].kind != tok_immediate )
{
- FT_ERROR(( "T1.Parse.RD: immediate character name expected\n" ));
+ FT_ERROR(( "Do_RD_Charstrings: immediate character name expected\n" ));
goto Syntax_Error;
}
/* check the count argument */
if ( top[1].kind != tok_number )
{
- FT_ERROR(( "T1.Parse.put: number expected\n" ));
+ FT_ERROR(( "Do_RD_Charstrings: number expected\n" ));
goto Syntax_Error;
}
- parser->args++;
+
+ parser->args++;
count = (FT_Int)CopyInteger( parser );
- error = parser->error; if (error) goto Exit;
+ error = parser->error;
+ if ( error )
+ goto Exit;
/* record the glyph name and get the corresponding glyph index */
if ( top[0].kind2 == imm_notdef )
@@ -796,30 +856,30 @@
{
FT_String temp_name[128];
T1_Token* token = top;
- FT_Int len = token->len-1;
+ FT_Int len = token->len - 1;
+
/* copy immediate name */
- if (len > 127) len = 127;
- MEM_Copy( temp_name, parser->tokenizer->base + token->start+1, len );
+ if ( len > 127 )
+ len = 127;
+ MEM_Copy( temp_name, parser->tokenizer->base + token->start + 1, len );
temp_name[len] = '\0';
index = parser->cur_name++;
- error = T1_Add_Table( &parser->table, index*2, (FT_Byte*)temp_name, len+1 );
- if (error) goto Exit;
+ error = T1_Add_Table( &parser->table, index * 2,
+ (FT_Byte*)temp_name, len + 1 );
+ if ( error )
+ goto Exit;
}
/* decrypt and record charstring, then skip them */
{
FT_Byte* base = tokzer->base + tokzer->cursor;
+
tokzer->cursor += count; /* skip */
- /* some fonts use a value of -1 for lenIV to indicate that */
- /* the charstrings are unencoded.. */
- /* */
- /* thanks to Tom Kacvinsky for pointing this out.. */
- /* */
- if (face->type1.private_dict.lenIV >= 0)
+ if ( face->type1.private_dict.lenIV >= 0 )
{
t1_decrypt( base, count, 4330 );
@@ -827,11 +887,11 @@
count -= face->type1.private_dict.lenIV;
}
- error = T1_Add_Table( &parser->table, index*2+1, base, count );
+ error = T1_Add_Table( &parser->table, index * 2 + 1, base, count );
}
- /* consume the closing ND */
- if (!error)
+ /* consume the closing `ND' */
+ if ( !error )
error = Expect_Keyword( parser, key_ND );
Exit:
@@ -842,23 +902,19 @@
}
-
-
-
-
static
FT_Error Expect_Dict_Arguments( T1_Parser* parser,
FT_Int num_args,
T1_TokenType immediate,
T1_DictState new_state,
- FT_Int *count )
+ FT_Int* count )
{
/* check that we have enough arguments in the stack, including */
- /* the 'dict' keyword.. */
+ /* the `dict' keyword */
if ( parser->top - parser->stack < num_args )
{
- FT_ERROR(( "T1.Parse.Dict : expecting at least %d arguments",
- num_args ));
+ FT_ERROR(( "Expect_Dict_Arguments: expecting at least %d arguments",
+ num_args ));
goto Syntax_Error;
}
@@ -868,30 +924,33 @@
if ( parser->top[-2].kind != tok_immediate ||
parser->top[-2].kind2 != immediate )
{
- FT_ERROR(( "T1.Parse.Dict : expecting '/%s' dictionary\n",
- t1_immediates[ immediate - imm_first_ ] ));
+ FT_ERROR(( "Expect_Dict_Arguments: expecting `/%s' dictionary\n",
+ t1_immediates[immediate - imm_first_] ));
goto Syntax_Error;
}
}
- parser->args = parser->top-1;
+ parser->args = parser->top-1;
/* check that the count argument is a number */
if ( parser->args->kind != tok_number )
{
- FT_ERROR(( "T1.Parse.Dict : expecting numerical count argument for 'dict'\n" ));
+ FT_ERROR(( "Expect_Dict_Arguments:" ));
+ FT_ERROR(( " expecting numerical count argument for `dict'\n" ));
goto Syntax_Error;
}
- if (count)
+
+ if ( count )
{
*count = CopyInteger( parser );
- if (parser->error) return parser->error;
+ if ( parser->error )
+ return parser->error;
}
/* save the dictionary state */
- parser->state_stack[ ++parser->state_index ] = new_state;
+ parser->state_stack[++parser->state_index] = new_state;
- /* consume the 'begin' keyword, and clear the stack */
+ /* consume the `begin' keyword and clear the stack */
parser->top -= num_args;
return Expect_Keyword( parser, key_begin );
@@ -900,9 +959,6 @@
}
-
-
-
static
FT_Error Expect_Array_Arguments( T1_Parser* parser )
{
@@ -913,77 +969,80 @@
T1_Face face = parser->face;
FT_Memory memory = face->root.memory;
+
/* Check arguments format */
if ( top - parser->stack < 2 )
{
- FT_ERROR(( "T1.Parse.array: two arguments expected\n" ));
+ FT_ERROR(( "Expect_Array_Arguments: two arguments expected\n" ));
error = T1_Err_Stack_Underflow;
goto Exit;
}
parser->top -= 2;
top -= 2;
- parser->args = top + 1;
+ parser->args = top + 1;
if ( top[0].kind != tok_immediate )
{
- FT_ERROR(( "T1.Parse.array: first argument must be an immediate name\n" ));
+ FT_ERROR(( "Expect_Array_Arguments:" ));
+ FT_ERROR(( " first argument must be an immediate name\n" ));
goto Syntax_Error;
}
if ( top[1].kind != tok_number )
{
- FT_ERROR(( "T1.Parse.array: second argument must be a number\n" ));
+ FT_ERROR(( "Expect_Array_Arguments:" ));
+ FT_ERROR(( " second argument must be a number\n" ));
goto Syntax_Error;
}
+
count = (FT_Int)CopyInteger( parser );
- /* Is this an array we know about ?? */
+ /* Is this an array we know about? */
switch ( top[0].kind2 )
{
- case imm_Encoding:
- {
- T1_Encoding* encode = &face->type1.encoding;
-
- new_state = dict_encoding;
-
- encode->code_first = count;
- encode->code_last = 0;
- encode->num_chars = count;
+ case imm_Encoding:
+ {
+ T1_Encoding* encode = &face->type1.encoding;
- /* allocate the table of character indexes. The table of */
- /* character names is allocated through init_t1_recorder */
- if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) )
- return error;
- error = T1_New_Table( &parser->table, count, memory );
- if (error) goto Exit;
+ new_state = dict_encoding;
- parser->encoding_type = t1_encoding_array;
- }
- break;
+ encode->code_first = count;
+ encode->code_last = 0;
+ encode->num_chars = count;
+ /* Allocate the table of character indices. The table of */
+ /* character names is allocated through init_t1_recorder(). */
+ if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) )
+ return error;
- case imm_Subrs:
- {
- new_state = dict_subrs;
- face->type1.num_subrs = count;
+ error = T1_New_Table( &parser->table, count, memory );
+ if ( error )
+ goto Exit;
- error = T1_New_Table( &parser->table, count, memory );
- if (error) goto Exit;
- }
- break;
+ parser->encoding_type = t1_encoding_array;
+ }
+ break;
+ case imm_Subrs:
+ new_state = dict_subrs;
+ face->type1.num_subrs = count;
- case imm_CharStrings:
- new_state = dict_charstrings;
- break;
+ error = T1_New_Table( &parser->table, count, memory );
+ if ( error )
+ goto Exit;
+ break;
+ case imm_CharStrings:
+ new_state = dict_charstrings;
+ break;
- default:
- new_state = dict_unknown_array;
+ default:
+ new_state = dict_unknown_array;
}
- parser->state_stack[ ++parser->state_index ] = new_state;
+
+ parser->state_stack[++parser->state_index] = new_state;
Exit:
return error;
@@ -993,132 +1052,154 @@
}
-
-
static
- FT_Error Finalise_Parsing( T1_Parser* parser )
+ FT_Error Finalize_Parsing( T1_Parser* parser )
{
- T1_Face face = parser->face;
- T1_Font* type1 = &face->type1;
- FT_Memory memory = face->root.memory;
- T1_Table* strings = &parser->table;
- PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
- FT_Int num_glyphs;
- FT_Int n;
- FT_Error error;
+ T1_Face face = parser->face;
+ T1_Font* type1 = &face->type1;
+ FT_Memory memory = face->root.memory;
+ T1_Table* strings = &parser->table;
+ PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
+
+ FT_Int num_glyphs;
+ FT_Int n;
+ FT_Error error;
+
num_glyphs = type1->num_glyphs = parser->cur_name;
- /* allocate glyph names and charstrings arrays */
- if ( ALLOC_ARRAY( type1->glyph_names , num_glyphs, FT_String* ) ||
- ALLOC_ARRAY( type1->charstrings , num_glyphs, FT_Byte* ) ||
- ALLOC_ARRAY( type1->charstrings_len, num_glyphs, FT_Int* ) )
- return error;
+ /* allocate glyph names and charstrings arrays */
+ if ( ALLOC_ARRAY( type1->glyph_names, num_glyphs, FT_String* ) ||
+ ALLOC_ARRAY( type1->charstrings, num_glyphs, FT_Byte* ) ||
+ ALLOC_ARRAY( type1->charstrings_len, num_glyphs, FT_Int* ) )
+ return error;
- /* copy glyph names and charstrings offsets and lengths */
+ /* copy glyph names and charstrings offsets and lengths */
type1->charstrings_block = strings->block;
- for ( n = 0; n < num_glyphs; n++ )
- {
- type1->glyph_names[n] = (FT_String*)strings->elements[2*n];
- type1->charstrings[n] = strings->elements[2*n+1];
- type1->charstrings_len[n] = strings->lengths [2*n+1];
+ for ( n = 0; n < num_glyphs; n++ )
+ {
+ type1->glyph_names[n] = (FT_String*)strings->elements[2 * n];
+ type1->charstrings[n] = strings->elements[2 * n + 1];
+ type1->charstrings_len[n] = strings->lengths [2 * n + 1];
}
- /* now free the old tables */
- FREE( strings->elements );
- FREE( strings->lengths );
+ /* now free the old tables */
+ FREE( strings->elements );
+ FREE( strings->lengths );
- if (!psnames)
+ if ( !psnames )
{
- FT_ERROR(( "T1.Parse.Finalise : PSNames module missing !!\n" ));
+ FT_ERROR(( "Finalize_Parsing: `PSNames' module missing!\n" ));
return T1_Err_Unimplemented_Feature;
}
- /* Compute encoding if required. */
- if (parser->encoding_type == t1_encoding_none)
+ /* compute encoding if required */
+ if ( parser->encoding_type == t1_encoding_none )
{
- FT_ERROR(( "T1.Parse.Finalise : no encoding specified in font file\n" ));
- return T1_Err_Syntax_Error;
+ FT_ERROR(( "Finalize_Parsing: no encoding specified in font file\n" ));
+ return T1_Err_Syntax_Error;
}
- {
- FT_Int n;
- T1_Encoding* encode = &type1->encoding;
-
- encode->code_first = encode->num_chars-1;
- encode->code_last = 0;
-
- for ( n = 0; n < encode->num_chars; n++ )
- {
- FT_String** names;
- FT_Int index;
- FT_Int m;
-
- switch (parser->encoding_type)
- {
- case t1_encoding_standard:
- index = psnames->adobe_std_encoding[n];
- names = 0;
- break;
-
- case t1_encoding_expert:
- index = psnames->adobe_expert_encoding[n];
- names = 0;
- break;
-
- default:
- index = n;
- names = (FT_String**)parser->encoding_offsets;
- }
- encode->char_index[n] = 0;
- if (index)
- {
- FT_String* name;
-
- if (names)
+ {
+ FT_Int n;
+ T1_Encoding* encode = &type1->encoding;
+
+
+ encode->code_first = encode->num_chars - 1;
+ encode->code_last = 0;
+
+ for ( n = 0; n < encode->num_chars; n++ )
+ {
+ FT_String** names;
+ FT_Int index;
+ FT_Int m;
+
+
+ switch ( parser->encoding_type )
+ {
+ case t1_encoding_standard:
+ index = psnames->adobe_std_encoding[n];
+ names = 0;
+ break;
+
+ case t1_encoding_expert:
+ index = psnames->adobe_expert_encoding[n];
+ names = 0;
+ break;
+
+ default:
+ index = n;
+ names = (FT_String**)parser->encoding_offsets;
+ }
+
+ encode->char_index[n] = 0;
+
+ if ( index )
+ {
+ FT_String* name;
+
+
+ if ( names )
name = names[index];
else
name = (FT_String*)psnames->adobe_std_strings(index);
- if ( name )
- {
- FT_Int len = strlen(name);
+ if ( name )
+ {
+ FT_Int len = strlen( name );
+
/* lookup glyph index from name */
for ( m = 0; m < num_glyphs; m++ )
- {
- if ( strncmp( type1->glyph_names[m], name, len ) == 0 )
- {
- encode->char_index[n] = m;
- break;
- }
- }
-
- if ( n < encode->code_first ) encode->code_first = n;
- if ( n > encode->code_last ) encode->code_last = n;
- }
- }
- }
-
- parser->encoding_type = t1_encoding_none;
- FREE( parser->encoding_names );
- FREE( parser->encoding_lengths );
- FREE( parser->encoding_offsets );
- }
+ {
+ if ( strncmp( type1->glyph_names[m], name, len ) == 0 )
+ {
+ encode->char_index[n] = m;
+ break;
+ }
+ }
- return T1_Err_Ok;
- }
+ if ( n < encode->code_first ) encode->code_first = n;
+ if ( n > encode->code_last ) encode->code_last = n;
+ }
+ }
+ }
+ parser->encoding_type = t1_encoding_none;
+ FREE( parser->encoding_names );
+ FREE( parser->encoding_lengths );
+ FREE( parser->encoding_offsets );
+ }
+ return T1_Err_Ok;
+ }
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* Parse_T1_FontProgram */
+ /* */
+ /* <Description> */
+ /* Parses a given Type 1 font file and builds its face object. */
+ /* */
+ /* <InOut> */
+ /* parser :: A handle to the target parser object. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The parser contains a handle to the target face object. */
+ /* */
LOCAL_FUNC
FT_Error Parse_T1_FontProgram( T1_Parser* parser )
{
FT_Error error;
T1_Font* type1 = &parser->face->type1;
+
for (;;)
{
T1_Token token;
@@ -1126,373 +1207,367 @@
T1_DictState dict_state;
FT_Int dict_index;
+
error = Next_T1_Token( parser, &token );
top = parser->top;
dict_index = parser->state_index;
- dict_state = parser->state_stack[ dict_index ];
+ dict_state = parser->state_stack[dict_index];
switch ( token.kind )
{
- /* A keyword was detected */
- case tok_keyword:
- switch (token.kind2)
+ /* a keyword has been detected */
+ case tok_keyword:
+ switch ( token.kind2 )
+ {
+ case key_dict:
+ switch ( dict_state )
{
- case key_dict:
-
- switch (dict_state)
- {
- case dict_none:
- /* All right, we're beggining the font dictionary */
- /* check that we only have one number argument, then */
- /* consume the 'begin' and change to 'dict_font' */
- /* state.. */
- error = Expect_Dict_Arguments( parser, 1, tok_error,
- dict_font, 0 );
- if (error) goto Exit;
-
- /* clear stack from all the previous content. This */
- /* could be some stupid Postscript code ... */
- parser->top = parser->stack;
- break;
-
-
- case dict_font:
- /* This must be the /FontInfo dictionary, so check */
- /* That we have at least two arguments, that they */
- /* are "/FontInfo" and a number, then change the */
- /* dictionary state.. */
- error = Expect_Dict_Arguments( parser, 2, imm_FontInfo,
- dict_fontinfo, 0 );
- if (error) goto Exit;
- break;
-
-
- case dict_none2:
- error = Expect_Dict_Arguments( parser, 2, imm_Private,
- dict_private, 0 );
- if (error) goto Exit;
- break;
-
-
- case dict_private:
- {
- T1_Face face = parser->face;
- FT_Int count;
-
- error = Expect_Dict_Arguments( parser, 2, imm_CharStrings,
- dict_charstrings, &count );
- if (error) goto Exit;
-
- type1->num_glyphs = count;
- error = T1_New_Table( &parser->table, count*2, face->root.memory );
- if (error) goto Exit;
-
- /* record '.notdef' as the first glyph in the font */
- error = T1_Add_Table( &parser->table, 0, (FT_Byte*)".notdef", 8 );
- parser->cur_name = 1;
- /* XXXXX : DO SOMETHING HERE */
- }
- break;
-
- default:
- /* All other uses are invalid */
- FT_ERROR(( "T1.Parse: invalid use of the 'dict' keyword\n" ));
- goto Syntax_Error;
- }
- break;
+ case dict_none:
+ /* All right, we are beginning the font dictionary. */
+ /* Check that we only have one number argument, then */
+ /* consume the `begin' and change to `dict_font' */
+ /* state. */
+ error = Expect_Dict_Arguments( parser, 1, tok_error,
+ dict_font, 0 );
+ if ( error )
+ goto Exit;
+
+ /* clear stack from all the previous content. This */
+ /* could be some stupid Postscript code. */
+ parser->top = parser->stack;
+ break;
+
+ case dict_font:
+ /* This must be the /FontInfo dictionary, so check */
+ /* that we have at least two arguments, that they */
+ /* are `/FontInfo' and a number, then change the */
+ /* dictionary state. */
+ error = Expect_Dict_Arguments( parser, 2, imm_FontInfo,
+ dict_fontinfo, 0 );
+ if ( error )
+ goto Exit;
+ break;
+
+ case dict_none2:
+ error = Expect_Dict_Arguments( parser, 2, imm_Private,
+ dict_private, 0 );
+ if ( error )
+ goto Exit;
+ break;
+
+ case dict_private:
+ {
+ T1_Face face = parser->face;
+ FT_Int count;
+
+
+ error = Expect_Dict_Arguments( parser, 2, imm_CharStrings,
+ dict_charstrings, &count );
+ if ( error )
+ goto Exit;
+
+ type1->num_glyphs = count;
+ error = T1_New_Table( &parser->table, count * 2,
+ face->root.memory );
+ if ( error )
+ goto Exit;
+
+ /* record `.notdef' as the first glyph in the font */
+ error = T1_Add_Table( &parser->table, 0,
+ (FT_Byte*)".notdef", 8 );
+ parser->cur_name = 1;
+ /* XXX: DO SOMETHING HERE */
+ }
+ break;
+
+ default:
+ /* All other uses are invalid */
+ FT_ERROR(( "Parse_T1_FontProgram:" ));
+ FT_ERROR(( " invalid use of `dict' keyword\n" ));
+ goto Syntax_Error;
+ }
+ break;
+ case key_array:
+ /* Are we in an array yet? If so, raise an error */
+ switch ( dict_state )
+ {
+ case dict_encoding:
+ case dict_subrs:
+ case dict_othersubrs:
+ case dict_charstrings:
+ case dict_unknown_array:
+ FT_ERROR(( "Parse_T1_FontProgram: nested array definitions\n" ));
+ goto Syntax_Error;
+
+ default:
+ ;
+ }
+ error = Expect_Array_Arguments( parser );
+ if ( error )
+ goto Exit;
+ break;
- case key_array:
- /* Are we in an array yet ? Is so, raise an error */
- switch (dict_state)
+ case key_ND:
+ case key_NP:
+ case key_def:
+ /* Are we in an array? If so, finalize it. */
+ switch ( dict_state )
+ {
+ case dict_encoding: /* finish encoding array */
+ /* copy table names to the face object */
+ T1_Done_Table( &parser->table );
+
+ parser->encoding_names = parser->table.block;
+ parser->encoding_lengths = parser->table.lengths;
+ parser->encoding_offsets = parser->table.elements;
+
+ parser->state_index--;
+ break;
+
+ case dict_subrs:
+ /* copy recorder sub-routines */
+ T1_Done_Table( &parser->table );
+
+ parser->subrs = parser->table.block;
+ type1->subrs = parser->table.elements;
+ type1->subrs_len = parser->table.lengths;
+ type1->subrs_block = parser->table.block;
+
+ parser->state_index--;
+ break;
+
+ case dict_charstrings:
+ case dict_othersubrs:
+ case dict_unknown_array:
+ FT_ERROR(( "Parse_T1_FontProgram: unsupported array\n" ));
+ goto Syntax_Error;
+ break;
+
+ default: /* normal `def' processing */
+ /* Check that we have sufficient operands in the stack */
+ if ( top >= parser->stack + 2 )
+ {
+ /* Now check that the first operand is an immediate. */
+ /* If so, call the appropriate `def' routine based */
+ /* on the current parser state. */
+ if ( top[-2].kind == tok_immediate )
{
- case dict_encoding: case dict_subrs:
- case dict_othersubrs: case dict_charstrings:
- case dict_unknown_array:
- FT_ERROR(( "T1.Parse.array: nested array definitions\n" ));
- goto Syntax_Error;
-
- default:
- ;
+ parser->top -= 2;
+ parser->args = parser->top + 1;
+ error = def_funcs[dict_state](parser);
}
- error = Expect_Array_Arguments( parser );
- if (error) goto Exit;
- break;
-
-
- case key_ND:
- case key_NP:
- case key_def:
- /* Are we in an array ? If so, finalise it.. */
- switch ( dict_state )
+ else
{
- case dict_encoding: /* finish encoding array */
- {
- /* copy table names to the face object */
- T1_Done_Table( &parser->table );
-
- parser->encoding_names = parser->table.block;
- parser->encoding_lengths = parser->table.lengths;
- parser->encoding_offsets = parser->table.elements;
-
- parser->state_index--;
- }
- break;
-
-
- case dict_subrs:
- {
- /* copy recorder sub-routines */
- T1_Done_Table( &parser->table );
-
- parser->subrs = parser->table.block;
- type1->subrs = parser->table.elements;
- type1->subrs_len = parser->table.lengths;
- type1->subrs_block = parser->table.block;
-
- parser->state_index--;
- }
- break;
-
- case dict_charstrings:
- case dict_othersubrs:
- case dict_unknown_array:
- FT_ERROR(( "T1.Parser.def: unsupported array\n" ));
- goto Syntax_Error;
- break;
-
- default: /* normal 'def' processing */
- {
- /* Check that we have sufficient operands in the stack */
- if ( top >= parser->stack+2 )
- {
- /* Now check that the first operand is an immediate */
- /* If so, call the appropriate "def" routine based */
- /* on the current parser state.. */
- if ( top[-2].kind == tok_immediate )
- {
- parser->top -= 2;
- parser->args = parser->top + 1;
- error = def_funcs[dict_state](parser);
- }
- else
- {
- /* This is an error, but some fonts contain some */
- /* stupid Postscript code. We simply ignore */
- /* an invalid 'def' by clearing the stack */
+ /* This is an error, but some fonts contain */
+ /* stupid Postscript code. We simply ignore */
+ /* an invalid `def' by clearing the stack. */
#if 0
- FT_ERROR(( "T1.Parse.def: immediate expected\n" ));
- goto Syntax_Error;
+ FT_ERROR(( "Parse_T1_FontProgram: immediate expected\n" ));
+ goto Syntax_Error;
#else
- parser->top = parser->stack;
+ parser->top = parser->stack;
#endif
- }
- }
- else
- {
- FT_ERROR(( "T1.Parse.def: not enough arguments\n" ));
- goto Stack_Underflow;
- }
- }
}
- break;
-
-
+ }
+ else
+ {
+ FT_ERROR(( "Parse_T1_FontProgram: not enough arguments\n" ));
+ goto Stack_Underflow;
+ }
+ }
+ break;
- case key_index:
- if ( top <= parser->stack )
- {
- FT_ERROR(( "T1.Parse.index: not enough arguments\n" ));
- goto Stack_Underflow;
- }
+ case key_index:
+ if ( top <= parser->stack )
+ {
+ FT_ERROR(( "Parse_T1_FontProgram: not enough arguments\n" ));
+ goto Stack_Underflow;
+ }
- /* simply ignore ?? */
- parser->top --;
- break;
+ /* simply ignore? */
+ parser->top --;
+ break;
+ case key_put:
+ /* Check that we have sufficient operands in stack */
+ if ( top < parser->stack + 2 )
+ {
+ FT_ERROR(( "Parse_T1_FontProgram: not enough arguments\n" ));
+ goto Stack_Underflow;
+ }
- case key_put:
- /* Check that we have sufficient operands in stack */
- if ( top < parser->stack+2 )
- {
- FT_ERROR(( "T1.Parse.put: not enough arguments\n" ));
- goto Stack_Underflow;
- }
+ parser->top -= 2;
+ parser->args = parser->top;
- parser->top -= 2;
- parser->args = parser->top;
- switch (dict_state)
- {
- case dict_encoding:
- error = Do_Put_Encoding( parser );
- if (error) goto Exit;
- break;
+ switch ( dict_state )
+ {
+ case dict_encoding:
+ error = Do_Put_Encoding( parser );
+ if ( error )
+ goto Exit;
+ break;
- case dict_unknown_array: /* ignore the put */
- break;
+ case dict_unknown_array: /* ignore the `put' */
+ break;
- default:
+ default:
#if 0
- FT_ERROR(( "T1.Parse.put: invalid context\n" ));
- goto Syntax_Error;
+ FT_ERROR(( "Parse_T1_FontProgram: invalid context\n" ));
+ goto Syntax_Error;
#else
- /* invalid context, simply ignore the put and */
- /* clear the stack (stupid Postscript code..) */
- FT_TRACE4(( "T1.Parse.put: invalid context. ignored.\n" ));
- parser->top = parser->stack;
+ /* invalid context; simply ignore the `put' and */
+ /* clear the stack (stupid Postscript code) */
+ FT_TRACE4(( "Parse_T1_FontProgram: invalid context ignored.\n" ));
+ parser->top = parser->stack;
#endif
- }
- break;
-
-
-
- case key_RD:
- /* Check that we have sufficient operands in stack */
- if ( top < parser->stack+2 )
- {
- FT_ERROR(( "T1.Parse.RD: not enough arguments\n" ));
- goto Stack_Underflow;
- }
-
- parser->top -= 2;
- parser->args = parser->top;
- switch (dict_state)
- {
- case dict_subrs:
- error = Do_RD_Subrs( parser );
- if (error) goto Exit;
- break;
-
- case dict_charstrings:
- error = Do_RD_Charstrings( parser );
- if (error) goto Exit;
- break;
-
- default:
- FT_ERROR(( "T1.Parse.RD: invalid context\n" ));
- goto Syntax_Error;
- }
- break;
+ }
+ break;
+ case key_RD:
+ /* Check that we have sufficient operands in stack */
+ if ( top < parser->stack + 2 )
+ {
+ FT_ERROR(( "Parse_T1_FontProgram: not enough arguments\n" ));
+ goto Stack_Underflow;
+ }
+ parser->top -= 2;
+ parser->args = parser->top;
+ switch ( dict_state )
+ {
+ case dict_subrs:
+ error = Do_RD_Subrs( parser );
+ if ( error )
+ goto Exit;
+ break;
+
+ case dict_charstrings:
+ error = Do_RD_Charstrings( parser );
+ if ( error )
+ goto Exit;
+ break;
+
+ default:
+ FT_ERROR(( "Parse_T1_FontProgram: invalid context\n" ));
+ goto Syntax_Error;
+ }
+ break;
- case key_end:
- /* Were we in a dictionary or in an array ? */
- if ( dict_index <= 0 )
- {
- FT_ERROR(( "T1.Parse.end: no dictionary defined\n" ));
- goto Syntax_Error;
- }
+ case key_end:
+ /* Were we in a dictionary or in an array? */
+ if ( dict_index <= 0 )
+ {
+ FT_ERROR(( "Parse_T1_FontProgram: no dictionary defined\n" ));
+ goto Syntax_Error;
+ }
- switch (dict_state)
- {
- /* Jump to the private dictionary if we're closing the */
- /* /Font dictionary.. */
- case dict_font:
- goto Open_Private;
-
- /* Exit the parser when closing the CharStrings dictionary */
- case dict_charstrings:
- return Finalise_Parsing( parser );
-
- default:
- /* Pop the current dictionary state and return to previous */
- /* one. Consume the "def".. */
-
- /* Because some buggy fonts (BitStream) have incorrect */
- /* syntax, we never escape from the private dictionary */
- if (dict_state != dict_private)
- parser->state_index--;
-
- /* many fonts use a NP instead of def or put, so */
- /* we simply ignore the nest token.. */
+ switch ( dict_state )
+ {
+ /* jump to the private dictionary if we are closing the */
+ /* `/Font' dictionary */
+ case dict_font:
+ goto Open_Private;
+
+ /* exit the parser when closing the CharStrings dictionary */
+ case dict_charstrings:
+ return Finalize_Parsing( parser );
+
+ default:
+ /* Pop the current dictionary state and return to previous */
+ /* one. Consume the `def'. */
+
+ /* Because some buggy fonts (BitStream) have incorrect */
+ /* syntax, we never escape from the private dictionary */
+ if ( dict_state != dict_private )
+ parser->state_index--;
+
+ /* many fonts use `NP' instead of `def' or `put', so */
+ /* we simply ignore the next token */
#if 0
- error = Expect_Keyword2( parser, key_def, key_put );
- if (error) goto Exit;
+ error = Expect_Keyword2( parser, key_def, key_put );
+ if ( error )
+ goto Exit;
#else
- (void)Expect_Keyword2( parser, key_def, key_put );
+ (void)Expect_Keyword2( parser, key_def, key_put );
#endif
- }
- break;
-
-
-
- case key_for:
- /* check that we have four arguments, and simply */
- /* ignore them.. */
- if ( top - parser->stack < 4 )
- {
- FT_ERROR(( "T1.Parse.for: not enough arguments\n" ));
- goto Stack_Underflow;
- }
-
- parser->top -= 4;
- break;
-
-
-
- case key_currentdict:
-
- Open_Private:
- parser->state_index = 0;
- parser->state_stack[0] = dict_none2;
- error = Open_PrivateDict( parser->tokenizer );
- if (error) goto Exit;
- break;
-
-
- case key_true:
- case key_false:
- case key_StandardEncoding:
- case key_ExpertEncoding:
- goto Push_Element;
-
-
- default:
- FT_ERROR(( "T1.Parser: invalid keyword in context\n" ));
- error = T1_Err_Syntax_Error;
}
break;
- /* check for the presence of /BlendAxisTypes, we cannot deal with */
- /* multiple master fonts, so we must return a correct error code */
- /* to allow another driver to load them.. */
- case tok_immediate:
- if (token.kind2 == imm_BlendAxisTypes)
+ case key_for:
+ /* check that we have four arguments and simply */
+ /* ignore them */
+ if ( top - parser->stack < 4 )
{
- error = FT_Err_Unknown_File_Format;
- goto Exit;
+ FT_ERROR(( "Parse_T1_FontProgram: not enough arguments\n" ));
+ goto Stack_Underflow;
}
- /* fallthrough */
- /* A number was detected */
- case tok_string:
- case tok_program:
- case tok_array:
- case tok_hexarray:
- case tok_any:
- case tok_number: /* push number on stack */
-
- Push_Element:
- if ( top >= parser->limit )
- {
- error = T1_Err_Stack_Overflow;
+ parser->top -= 4;
+ break;
+
+ case key_currentdict:
+ Open_Private:
+ parser->state_index = 0;
+ parser->state_stack[0] = dict_none2;
+ error = Open_PrivateDict( parser->tokenizer );
+ if ( error )
goto Exit;
- }
- else
- *parser->top++ = token;
break;
- /* anything else is an error per se the spec, but we */
- /* frequently encountre stupid postscript code in fonts, */
- /* so just ignore them.. */
+ case key_true:
+ case key_false:
+ case key_StandardEncoding:
+ case key_ExpertEncoding:
+ goto Push_Element;
+
default:
- error = T1_Err_Ok; /* ignore token */
+ FT_ERROR(( "Parse_T1_FontProgram:" ));
+ FT_ERROR(( " invalid keyword in context\n" ));
+ error = T1_Err_Syntax_Error;
+ }
+ break;
+
+ /* check for the presence of `/BlendAxisTypes' -- we cannot deal */
+ /* with multiple master fonts, so we must return a correct error */
+ /* code to allow another driver to load them */
+ case tok_immediate:
+ if ( token.kind2 == imm_BlendAxisTypes )
+ {
+ error = FT_Err_Unknown_File_Format;
+ goto Exit;
+ }
+ /* fallthrough */
+
+ /* A number was detected */
+ case tok_string:
+ case tok_program:
+ case tok_array:
+ case tok_hexarray:
+ case tok_any:
+ case tok_number: /* push number on stack */
+
+ Push_Element:
+ if ( top >= parser->limit )
+ {
+ error = T1_Err_Stack_Overflow;
+ goto Exit;
+ }
+ else
+ *parser->top++ = token;
+ break;
+
+ /* anything else is an error per se the spec, but we */
+ /* frequently encounter stupid postscript code in fonts, */
+ /* so just ignore them */
+ default:
+ error = T1_Err_Ok; /* ignore token */
}
- if (error)
+ if ( error )
return error;
}
+
Exit:
return error;
@@ -1503,3 +1578,5 @@
return T1_Err_Stack_Underflow;
}
+
+/* END */
diff --git a/src/type1/t1load.h b/src/type1/t1load.h
index f624e29..b9ce9b0 100644
--- a/src/type1/t1load.h
+++ b/src/type1/t1load.h
@@ -1,19 +1,20 @@
-/*******************************************************************
- *
- * t1load.h 1.0
- *
- * Type1 Loader.
- *
- * Copyright 1996-1998 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.
- *
- ******************************************************************/
+/***************************************************************************/
+/* */
+/* t1load.h */
+/* */
+/* Type 1 font loader (specification). */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
#ifndef T1LOAD_H
#define T1LOAD_H
@@ -25,41 +26,14 @@
extern "C" {
#endif
- /*************************************************************************/
- /* */
- /* <Function> Init_T1_Parser */
- /* */
- /* <Description> */
- /* Initialise a given parser object to build a given T1_Face */
- /* */
- /* <Input> */
- /* parser :: handle to the newly built parser object */
- /* face :: handle to target T1 face object */
- /* */
- LOCAL_DEF
- void Init_T1_Parser( T1_Parser* parser,
- T1_Face face,
- T1_Tokenizer tokenizer );
+ LOCAL_DEF
+ void Init_T1_Parser( T1_Parser* parser,
+ T1_Face face,
+ T1_Tokenizer tokenizer );
- /*************************************************************************/
- /* */
- /* <Function> Parse_T1_FontProgram */
- /* */
- /* <Description> */
- /* Parses a given Type 1 font file and builds its face object */
- /* */
- /* <Input> */
- /* parser :: handle to target parser object */
- /* */
- /* <Return> */
- /* Error code. 0 means success.. */
- /* */
- /* <Note> */
- /* The parser contains a handle to the target face object. */
- /* */
- LOCAL_DEF
- FT_Error Parse_T1_FontProgram( T1_Parser* parser );
+ LOCAL_DEF
+ FT_Error Parse_T1_FontProgram( T1_Parser* parser );
#ifdef __cplusplus