Formatting, small fixes. Adding copyright notices etc.
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
diff --git a/builds/unix/devel/freetype/config/ftoption.h b/builds/unix/devel/freetype/config/ftoption.h
index fd31bef..e27ed9f 100644
--- a/builds/unix/devel/freetype/config/ftoption.h
+++ b/builds/unix/devel/freetype/config/ftoption.h
@@ -354,11 +354,12 @@
/*************************************************************************/
/* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
- /* A minimum of 16 is required.. */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
+
/*************************************************************************/
/* */
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk
index 3454330..b26e150 100644
--- a/builds/unix/unix-dev.mk
+++ b/builds/unix/unix-dev.mk
@@ -14,9 +14,6 @@
# indicate that you have read the license and understand and accept it
# fully.
#
-# NOTE: This version requires that GNU Make is invoked from the Windows
-# Shell (_not_ Cygwin BASH)!
-#
ifndef TOP
TOP := .
@@ -25,8 +22,8 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
-BUILD := $(TOP)/builds/unix/devel
-PLATFORM := unixdev # do not set it to "unix", or libtool will trick you..
+BUILD := $(TOP)/builds/unix/devel # we use a special devel ftoption.h
+PLATFORM := unixdev # do not set it to `unix', or libtool will trick you
CC := gcc
# The directory where all object files are placed.
diff --git a/builds/win32/devel/freetype/config/ftoption.h b/builds/win32/devel/freetype/config/ftoption.h
index fd31bef..e27ed9f 100644
--- a/builds/win32/devel/freetype/config/ftoption.h
+++ b/builds/win32/devel/freetype/config/ftoption.h
@@ -354,11 +354,12 @@
/*************************************************************************/
/* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
- /* A minimum of 16 is required.. */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
+
/*************************************************************************/
/* */
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
diff --git a/builds/win32/w32-dev.mk b/builds/win32/w32-dev.mk
index fa91cc4..69262b7 100644
--- a/builds/win32/w32-dev.mk
+++ b/builds/win32/w32-dev.mk
@@ -25,7 +25,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
-BUILD := $(TOP)/builds/win32/devel
+BUILD := $(TOP)/builds/win32/devel # we use a special devel ftoption.h
PLATFORM := win32
CC := gcc
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index b93187c..a95c91c 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -354,11 +354,12 @@
/*************************************************************************/
/* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
- /* A minimum of 16 is required.. */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
+
/*************************************************************************/
/* */
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index cd1b3d3..02c9088 100644
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -218,10 +218,10 @@
enum
{
- ft_glyph_bbox_subpixels = 0, /* return unfitted coordinates in 26.6 pixels */
- ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */
- ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
- ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */
+ ft_glyph_bbox_subpixels = 0, /* return unfitted 26.6 coordinates */
+ ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */
+ ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
+ ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */
};
diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index 32cc840..72d7c4f 100644
--- a/include/freetype/ftsynth.h
+++ b/include/freetype/ftsynth.h
@@ -1,18 +1,51 @@
+/***************************************************************************/
+/* */
+/* ftsynth.h */
+/* */
+/* FreeType synthesizing code for emboldening and slanting */
+/* (specification). */
+/* */
+/* Copyright 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 FTSYNTH_H
#define FTSYNTH_H
#include <freetype/freetype.h>
- /* this code is completely experimental - use with care */
- /* it will probably be completely rewritten in the future */
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ /* This code is completely experimental - use with care! */
+ /* It will probably be completely rewritten in the future */
/* or even integrated within the library... */
- FT_EXPORT_DEF(FT_Error) FT_Embolden_Outline( FT_Face original,
- FT_Outline* outline,
- FT_Pos* advance );
+ FT_EXPORT_DEF( FT_Error ) FT_Embolden_Outline( FT_Face original,
+ FT_Outline* outline,
+ FT_Pos* advance );
+
+ FT_EXPORT_DEF( FT_Error ) FT_Oblique_Outline( FT_Face original,
+ FT_Outline* outline,
+ FT_Pos* advance );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
- FT_EXPORT_DEF(FT_Error) FT_Oblique_Outline( FT_Face original,
- FT_Outline* outline,
- FT_Pos* advance );
+#endif /* FTSYNTH_H */
-#endif /* FTEMBOLD_H */
+/* END */
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index ae36bca..c70b7e8 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -84,7 +84,7 @@
trace_t1load,
trace_t1objs,
- /* Postcript helper module 'psaux' */
+ /* PostScript helper module `psaux' */
trace_t1decode,
trace_psobjs,
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index ab47527..8c8fa7a 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -37,36 +37,41 @@
/*************************************************************************/
/*************************************************************************/
+
typedef struct PS_Table_ PS_Table;
+
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Table_Funcs */
/* */
/* <Description> */
- /* A set of function pointers used to manage PS_Table objects.. */
+ /* A set of function pointers to manage PS_Table objects. */
/* */
/* <Fields> */
- /* table_init :: used to initialise a a table */
- /* table_done :: finalize/destroy a given table */
- /* table_add :: add one new object to a table */
- /* table_release :: release table data, then finalize it */
+ /* table_init :: Used to initialize a table. */
+ /* */
+ /* table_done :: Finalizes resp. destroy a given table. */
+ /* */
+ /* table_add :: Adds a new object to a table. */
/* */
- typedef struct PS_Table_Funcs_
+ /* table_release :: Releases table data, then finalizes it. */
+ /* */
+ typedef struct PS_Table_Funcs_
{
- FT_Error (*init) ( PS_Table* table,
- FT_Int count,
- FT_Memory memory );
+ FT_Error (*init) ( PS_Table* table,
+ FT_Int count,
+ FT_Memory memory );
- void (*done) ( PS_Table* table );
+ void (*done) ( PS_Table* table );
- FT_Error (*add) ( PS_Table* table,
- FT_Int index,
- void* object,
- FT_Int length );
+ FT_Error (*add) ( PS_Table* table,
+ FT_Int index,
+ void* object,
+ FT_Int length );
- void (*release)( PS_Table* table );
+ void (*release)( PS_Table* table );
} PS_Table_Funcs;
@@ -101,19 +106,19 @@
/* memory :: The object used for memory operations */
/* (alloc/realloc). */
/* */
- /* funcs :: table of method pointers for this object */
+ /* funcs :: A table of method pointers for this object. */
/* */
struct PS_Table_
{
- FT_Byte* block; /* current memory block */
- FT_Int cursor; /* current cursor in memory block */
- FT_Int capacity; /* current size of memory block */
- FT_Long init;
+ FT_Byte* block; /* current memory block */
+ FT_Int cursor; /* current cursor in memory block */
+ FT_Int capacity; /* current size of memory block */
+ FT_Long init;
- FT_Int max_elems;
- FT_Int num_elems;
- FT_Byte** elements; /* addresses of table elements */
- FT_Int* lengths; /* lengths of table elements */
+ FT_Int max_elems;
+ FT_Int num_elems;
+ FT_Byte** elements; /* addresses of table elements */
+ FT_Int* lengths; /* lengths of table elements */
FT_Memory memory;
PS_Table_Funcs funcs;
@@ -121,8 +126,6 @@
};
-
-
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -131,6 +134,7 @@
/*************************************************************************/
/*************************************************************************/
+
/* simple enumeration type used to identify token types */
typedef enum T1_Token_Type_
{
@@ -264,28 +268,10 @@
/*************************************************************************/
/*************************************************************************/
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* T1_Parser */
- /* */
- /* <Description> */
- /* A T1_Parser is an object used to parse a Type 1 font very quickly. */
- /* */
- /* <Fields> */
- /* cursor :: The current position in the text. */
- /* */
- /* base :: Start of the processed text. */
- /* */
- /* limit :: End of the processed text. */
- /* */
- /* error :: The last error returned. */
- /* */
- /* funcs :: table of functions for the parser */
- /* */
- /* */
+
typedef struct T1_Parser_ T1_Parser;
+
typedef struct T1_Parser_Funcs_
{
void (*init) ( T1_Parser* parser,
@@ -331,13 +317,34 @@
} T1_Parser_Funcs;
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* T1_Parser */
+ /* */
+ /* <Description> */
+ /* A T1_Parser is an object used to parse a Type 1 font very quickly. */
+ /* */
+ /* <Fields> */
+ /* cursor :: The current position in the text. */
+ /* */
+ /* base :: Start of the processed text. */
+ /* */
+ /* limit :: End of the processed text. */
+ /* */
+ /* error :: The last error returned. */
+ /* */
+ /* memory :: The object used for memory operations (alloc/realloc). */
+ /* */
+ /* funcs :: A table of functions for the parser. */
+ /* */
struct T1_Parser_
{
- FT_Byte* cursor;
- FT_Byte* base;
- FT_Byte* limit;
- FT_Error error;
- FT_Memory memory;
+ FT_Byte* cursor;
+ FT_Byte* base;
+ FT_Byte* limit;
+ FT_Error error;
+ FT_Memory memory;
T1_Parser_Funcs funcs;
};
@@ -352,8 +359,10 @@
/*************************************************************************/
/*************************************************************************/
+
typedef struct T1_Builder_ T1_Builder;
+
typedef FT_Error (*T1_Builder_Check_Points_Func) ( T1_Builder* builder,
FT_Int count );
@@ -449,38 +458,38 @@
/* the metrics of a given glyph, not load all of its */
/* points. */
/* */
- /* funcs :: array of function pointers for the builder */
+ /* funcs :: An array of function pointers for the builder. */
/* */
struct T1_Builder_
{
- FT_Memory memory;
- FT_Face face;
- FT_GlyphSlot glyph;
- FT_GlyphLoader* loader;
- FT_Outline* base;
- FT_Outline* current;
+ FT_Memory memory;
+ FT_Face face;
+ FT_GlyphSlot glyph;
+ FT_GlyphLoader* loader;
+ FT_Outline* base;
+ FT_Outline* current;
- FT_Vector last;
+ FT_Vector last;
- FT_Fixed scale_x;
- FT_Fixed scale_y;
+ FT_Fixed scale_x;
+ FT_Fixed scale_y;
- FT_Pos pos_x;
- FT_Pos pos_y;
+ FT_Pos pos_x;
+ FT_Pos pos_y;
- FT_Vector left_bearing;
- FT_Vector advance;
+ FT_Vector left_bearing;
+ FT_Vector advance;
- FT_BBox bbox; /* bounding box */
- FT_Bool path_begun;
- FT_Bool load_points;
- FT_Bool no_recurse;
- FT_Bool shift;
+ FT_BBox bbox; /* bounding box */
+ FT_Bool path_begun;
+ FT_Bool load_points;
+ FT_Bool no_recurse;
+ FT_Bool shift;
- FT_Error error; /* only used for memory errors */
- FT_Bool metrics_only;
+ FT_Error error; /* only used for memory errors */
+ FT_Bool metrics_only;
- T1_Builder_Funcs funcs;
+ T1_Builder_Funcs funcs;
};
@@ -493,8 +502,9 @@
/*************************************************************************/
#if 0
-#define T1_MAX_CHARSTRINGS_OPERANDS 64
-#define T1_MAX_SUBRS_CALLS 16
+
+#define T1_MAX_CHARSTRINGS_OPERANDS 64
+#define T1_MAX_SUBRS_CALLS 16
/*************************************************************************/
/* */
@@ -506,15 +516,15 @@
/*************************************************************************/
/* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
- /* A minimum of 16 is required.. */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
-#endif
+#endif /* 0 */
- typedef struct T1_Decoder_Zone_
+ typedef struct T1_Decoder_Zone_
{
FT_Byte* cursor;
FT_Byte* base;
@@ -526,57 +536,58 @@
typedef struct T1_Decoder_ T1_Decoder;
typedef struct T1_Decoder_Funcs_ T1_Decoder_Funcs;
+
typedef FT_Error (*T1_Decoder_Callback)( T1_Decoder* decoder,
FT_UInt glyph_index );
- struct T1_Decoder_Funcs_
+
+ struct T1_Decoder_Funcs_
{
- FT_Error (*init) ( T1_Decoder* decoder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot,
- FT_Byte** glyph_names,
- T1_Blend* blend,
- T1_Decoder_Callback callback );
+ FT_Error (*init) ( T1_Decoder* decoder,
+ FT_Face face,
+ FT_Size size,
+ FT_GlyphSlot slot,
+ FT_Byte** glyph_names,
+ T1_Blend* blend,
+ T1_Decoder_Callback callback );
- void (*done) ( T1_Decoder* decoder );
+ void (*done) ( T1_Decoder* decoder );
- FT_Error (*parse_charstrings)( T1_Decoder* decoder,
- FT_Byte* base,
- FT_UInt len );
+ FT_Error (*parse_charstrings)( T1_Decoder* decoder,
+ FT_Byte* base,
+ FT_UInt len );
};
-
- struct T1_Decoder_
+ struct T1_Decoder_
{
- T1_Builder builder;
+ T1_Builder builder;
- FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
- FT_Long* top;
+ FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
+ FT_Long* top;
- T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
- T1_Decoder_Zone* zone;
+ T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
+ T1_Decoder_Zone* zone;
- PSNames_Interface* psnames; /* for seac */
- FT_UInt num_glyphs;
- FT_Byte** glyph_names;
+ PSNames_Interface* psnames; /* for seac */
+ FT_UInt num_glyphs;
+ FT_Byte** glyph_names;
- FT_UInt lenIV; /* internal for sub routine calls */
- FT_UInt num_subrs;
- FT_Byte** subrs;
- FT_Int* subrs_len; /* array of subrs length (optional) */
+ FT_UInt lenIV; /* internal for sub routine calls */
+ FT_UInt num_subrs;
+ FT_Byte** subrs;
+ FT_Int* subrs_len; /* array of subrs length (optional) */
- FT_Matrix font_matrix;
+ FT_Matrix font_matrix;
- FT_Int flex_state;
- FT_Int num_flex_vectors;
- FT_Vector flex_vectors[7];
+ FT_Int flex_state;
+ FT_Int num_flex_vectors;
+ FT_Vector flex_vectors[7];
- T1_Blend* blend; /* for multiple master support */
+ T1_Blend* blend; /* for multiple master support */
- T1_Decoder_Callback parse_callback;
- T1_Decoder_Funcs funcs;
+ T1_Decoder_Callback parse_callback;
+ T1_Decoder_Funcs funcs;
};
@@ -590,14 +601,14 @@
typedef struct PSAux_Interface_
{
- const PS_Table_Funcs* ps_table_funcs;
- const T1_Parser_Funcs* t1_parser_funcs;
- const T1_Builder_Funcs* t1_builder_funcs;
- const T1_Decoder_Funcs* t1_decoder_funcs;
-
- void (*t1_decrypt)( FT_Byte* buffer,
- FT_Int length,
- FT_UShort seed );
+ const PS_Table_Funcs* ps_table_funcs;
+ const T1_Parser_Funcs* t1_parser_funcs;
+ const T1_Builder_Funcs* t1_builder_funcs;
+ const T1_Decoder_Funcs* t1_decoder_funcs;
+
+ void (*t1_decrypt)( FT_Byte* buffer,
+ FT_Int length,
+ FT_UShort seed );
} PSAux_Interface;
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 5f9f1bc..dbf04fc 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -793,7 +793,7 @@
/* prepare dummy slot for rendering */
error = clazz->glyph_prepare( glyph, &dummy );
- if (!error)
+ if ( !error )
error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
if ( !destroy && origin )
@@ -859,9 +859,4 @@
}
-#if 1
-
-#endif /* 0 -- EXPERIMENTAL STUFF! */
-
-
/* END */
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 81d8a9d..1162671 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -1,7 +1,27 @@
+/***************************************************************************/
+/* */
+/* ftsynth.c */
+/* */
+/* FreeType synthesizing code for emboldening and slanting (body). */
+/* */
+/* Copyright 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/ftsynth.h>
+
#define FT_BOLD_THRESHOLD 0x0100
+
/*************************************************************************/
/*************************************************************************/
/**** ****/
@@ -10,16 +30,20 @@
/*************************************************************************/
/*************************************************************************/
- FT_EXPORT_DEF(FT_Error) FT_Oblique_Outline( FT_GlyphSlot original,
- FT_Outline* outline,
- FT_Pos* advance )
+ FT_EXPORT_DEF( FT_Error ) FT_Oblique_Outline( FT_GlyphSlot original,
+ FT_Outline* outline,
+ FT_Pos* advance )
{
FT_Matrix transform;
- FT_UNUSED(original);
+ FT_UNUSED( original );
+ /* we don't touch the advance width */
+ FT_UNUSED(advance);
+
+
/* For italic, simply apply a shear transform, with an angle */
- /* of about 12 degrees.. */
+ /* of about 12 degrees. */
transform.xx = 0x10000;
transform.yx = 0x00000;
@@ -29,12 +53,10 @@
FT_Transform_Outline( outline, &transform );
- /* we don't touch the advance width */
- FT_UNUSED(advance);
-
return 0;
}
+
/*************************************************************************/
/*************************************************************************/
/**** ****/
@@ -43,6 +65,7 @@
/*************************************************************************/
/*************************************************************************/
+
/* Compute the norm of a vector */
#ifdef FT_CONFIG_OPTION_OLD_CALCS
@@ -245,19 +268,19 @@
/* test orientation of the xmin */
n = ft_test_extrema( outline, indices.xMin );
- if (n)
+ if ( n )
goto Exit;
n = ft_test_extrema( outline, indices.yMin );
- if (n)
+ if ( n )
goto Exit;
n = ft_test_extrema( outline, indices.xMax );
- if (n)
+ if ( n )
goto Exit;
n = ft_test_extrema( outline, indices.yMax );
- if (!n)
+ if ( !n )
n = 1;
Exit:
@@ -269,12 +292,12 @@
FT_Outline* outline,
FT_Pos* advance )
{
- FT_Vector u, v;
- FT_Vector* points;
- FT_Vector cur, prev, next;
- FT_Pos distance;
- FT_Face face = FT_SLOT_FACE(original);
- int c, n, first, orientation;
+ FT_Vector u, v;
+ FT_Vector* points;
+ FT_Vector cur, prev, next;
+ FT_Pos distance;
+ FT_Face face = FT_SLOT_FACE( original );
+ int c, n, first, orientation;
FT_UNUSED( advance );
@@ -369,3 +392,4 @@
}
+/* END */
diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c
index 3c735e4..d2df6a6 100644
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -1,80 +1,106 @@
+/***************************************************************************/
+/* */
+/* ftcimage.c */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 <cache/ftcimage.h>
static
- void ftc_done_glyph_image( FTC_Image_Queue queue,
- FTC_ImageNode node )
+ void ftc_done_glyph_image( FTC_Image_Queue queue,
+ FTC_ImageNode node )
{
- FT_UNUSED(queue);
- FT_Done_Glyph( FTC_IMAGENODE_GET_GLYPH(node) );
+ FT_UNUSED( queue );
+
+ FT_Done_Glyph( FTC_IMAGENODE_GET_GLYPH( node ) );
}
+
static
- FT_ULong ftc_size_bitmap_image( FTC_Image_Queue queue,
- FTC_ImageNode node )
+ FT_ULong ftc_size_bitmap_image( FTC_Image_Queue queue,
+ FTC_ImageNode node )
{
FT_Long pitch;
FT_BitmapGlyph glyph;
- FT_UNUSED(queue);
+ FT_UNUSED( queue );
+
+
glyph = (FT_BitmapGlyph)FTC_IMAGENODE_GET_GLYPH(node);
pitch = glyph->bitmap.pitch;
- if (pitch < 0)
+ if ( pitch < 0 )
pitch = -pitch;
- return (FT_ULong)(pitch * glyph->bitmap->rows + sizeof(*glyph));
+ return (FT_ULong)(pitch * glyph->bitmap->rows + sizeof ( *glyph ) );
}
+
static
- FT_ULong ftc_size_outline_image( FTC_Image_Queue queue,
- FTC_ImageNode node )
+ FT_ULong ftc_size_outline_image( FTC_Image_Queue queue,
+ FTC_ImageNode node )
{
FT_Long pitch;
FT_OutlineGlyph glyph;
FT_Outline* outline;
- FT_UNUSED(queue);
- glyph = (FT_OutlineGlyph)FTC_IMAGENODE_GET_GLYPH(node);
+ FT_UNUSED( queue );
+
+
+ glyph = (FT_OutlineGlyph)FTC_IMAGENODE_GET_GLYPH( node );
outline = &glyph->outline;
return (FT_ULong)(
- outline->n_points * (sizeof(FT_Vector)+sizeof(FT_Byte)) +
- outline->n_contours * sizeof(FT_Short) +
- sizeof(*glyph) );
+ outline->n_points * ( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) +
+ outline->n_contours * sizeof ( FT_Short ) +
+ sizeof( *glyph ) );
}
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** MONOCHROME BITMAP CALLBACKS *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** MONOCHROME BITMAP CALLBACKS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
static
- FT_Error ftc_init_mono_image( FTC_Image_Queue queue,
- FTC_ImageNode node )
+ FT_Error ftc_init_mono_image( FTC_Image_Queue queue,
+ FTC_ImageNode node )
{
- FT_Face face;
- FT_Size size;
- FT_Error error;
+ FT_Face face;
+ FT_Size size;
+ FT_Error error;
error = FTC_Manager_Lookup_Size( queue->manager,
&queue->size_rec,
&face, &size );
- if (!error)
+ if ( !error )
{
- FT_UInt glyph_index = FTC_IMAGENODE_GINDEX(node);
+ FT_UInt glyph_index = FTC_IMAGENODE_GINDEX( node );
error = FT_Load_Glyph( face, glyph_index,
FT_LOAD_RENDER | FT_LOAD_MONOCHROME );
- if (!error)
+ if ( !error )
{
if ( face->glyph->format != ft_image_format_bitmap ||
- face->glyph->bitmap.pixel_mode != ft_pixel_mode_mono )
+ face->glyph->bitmap.pixel_mode != ft_pixel_mode_mono )
{
- /* there is no monochrome glyph for this font !! */
+ /* there is no monochrome glyph for this font! */
error = FT_Err_Invalid_Glyph_Index;
}
else
@@ -84,8 +110,8 @@
error = FT_Get_Glyph( face->glyph, &glyph );
- if (!error)
- FTC_IMAGENODE_SET_GLYPH(node,glyph);
+ if ( !error )
+ FTC_IMAGENODE_SET_GLYPH( node, glyph );
}
}
}
@@ -94,30 +120,30 @@
static
- FT_Error ftc_init_gray_image( FTC_Image_Queue queue,
- FTC_ImageNode node )
+ FT_Error ftc_init_gray_image( FTC_Image_Queue queue,
+ FTC_ImageNode node )
{
- FT_Face face;
- FT_Size size;
- FT_Error error;
+ FT_Face face;
+ FT_Size size;
+ FT_Error error;
error = FTC_Manager_Lookup_Size( queue->manager,
&queue->size_rec,
&face, &size );
- if (!error)
+ if ( !error )
{
- FT_UInt glyph_index = FTC_IMAGENODE_GINDEX(node);
+ FT_UInt glyph_index = FTC_IMAGENODE_GINDEX( node );
error = FT_Load_Glyph( face, glyph_index,
FT_LOAD_RENDER );
- if (!error)
+ if ( !error )
{
if ( face->glyph->format != ft_image_format_bitmap ||
face->glyph->bitmap.pixel_mode != ft_pixel_mode_grays )
{
- /* there is no monochrome glyph for this font !! */
+ /* there is no monochrome glyph for this font! */
error = FT_Err_Invalid_Glyph_Index;
}
else
@@ -127,8 +153,8 @@
error = FT_Get_Glyph( face->glyph, &glyph );
- if (!error)
- FTC_IMAGENODE_SET_GLYPH(node,glyph);
+ if ( !error )
+ FTC_IMAGENODE_SET_GLYPH( node, glyph );
}
}
}
@@ -136,12 +162,4 @@
}
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** MONOCHROME BITMAP CALLBACKS *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-
+/* END */
diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h
index ae00ce7..5a4d17f 100644
--- a/src/cache/ftcimage.h
+++ b/src/cache/ftcimage.h
@@ -1,15 +1,40 @@
+/***************************************************************************/
+/* */
+/* ftcimage.h */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 FTCIMAGE_H
#define FTCIMAGE_H
#include <cache/ftcmanag.h>
#include <freetype/ftglyph.h>
- typedef struct FTC_Image_QueueRec_* FTC_Image_Queue;
- typedef struct FTC_Image_CacheRec_* FTC_Image_Cache;
- typedef struct FTC_ImageNodeRec_* FTC_ImageNode;
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ typedef struct FTC_Image_QueueRec_* FTC_Image_Queue;
+ typedef struct FTC_Image_CacheRec_* FTC_Image_Cache;
+ typedef struct FTC_ImageNodeRec_* FTC_ImageNode;
+
/* types of glyph images */
- typedef enum FTC_Image_Type_
+ typedef enum FTC_Image_Type_
{
ftc_image_mono = 0, /* monochrome bitmap */
ftc_image_grays, /* anti-aliased bitmap */
@@ -22,34 +47,43 @@
/* a descriptor used to describe all glyphs in a given queue */
typedef struct FTC_Image_Desc_
{
- FTC_FaceID face_id;
- FT_UInt pix_width;
- FT_UInt pix_height;
- FT_UInt image_type;
+ FTC_FaceID face_id;
+ FT_UInt pix_width;
+ FT_UInt pix_height;
+ FT_UInt image_type;
} FTC_Image_Desc;
-/* macros used to pack a glyph index and a queue index in a single ptr */
-#define FTC_PTR_TO_GINDEX(p) ((FT_UInt)((FT_ULong)(p) >> 16))
-#define FTC_PTR_TO_QINDEX(p) ((FT_UInt)((FT_ULong)(p) & 0xFFFF))
-#define FTC_INDICES_TO_PTR(g,q) ((FT_Pointer)(((FT_ULong)(g) << 16) | \
- ((FT_ULong)(q) & 0xFFFF)))
+
+ /* macros used to pack a glyph index and a queue index in a single ptr */
+#define FTC_PTR_TO_GINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) >> 16 ) )
+#define FTC_PTR_TO_QINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) & 0xFFFF ) )
+#define FTC_INDICES_TO_PTR( g, q ) \
+ ( (FT_Pointer)( ( (FT_ULong)(g) << 16 ) | \
+ ( (FT_ULong)(q) & 0xFFFF) ) )
- typedef struct FTC_ImageNodeRec_
+ typedef struct FTC_ImageNodeRec_
{
- FT_ListNodeRec root1; /* root1.data contains a FT_Glyph handle */
- FT_ListNodeRec root2; /* root2.data contains a glyph index + queue index */
+ /* root1.data contains a FT_Glyph handle */
+ FT_ListNodeRec root1;
+
+ /* root2.data contains a glyph index + queue index */
+ FT_ListNodeRec root2;
} FTC_ImageNodeRec;
-/* macros to read/set the glyph & queue index in a FTC_ImageNode */
-#define FTC_IMAGENODE_GET_GINDEX(n) FTC_PTR_TO_GINDEX((n)->root2.data)
-#define FTC_IMAGENODE_GET_QINDEX(n) FTC_PTR_TO_QINDEX((n)->root2.data)
-#define FTC_IMAGENODE_SET_INDICES(g,q) \
- do { (n)->root2.data = FTC_INDICES_TO_PTR(g,q); } while (0)
+
+ /* macros to read/set the glyph & queue index in a FTC_ImageNode */
+#define FTC_IMAGENODE_GET_GINDEX( n ) FTC_PTR_TO_GINDEX( (n)->root2.data )
+#define FTC_IMAGENODE_GET_QINDEX( n ) FTC_PTR_TO_QINDEX( (n)->root2.data )
+#define FTC_IMAGENODE_SET_INDICES( g, q ) \
+ do \
+ { \
+ (n)->root2.data = FTC_INDICES_TO_PTR( g, q ); \
+ } while ( 0 )
- typedef struct FTC_Image_CacheRec_
+ typedef struct FTC_Image_CacheRec_
{
FTC_Manager manager;
FT_Memory memory;
@@ -62,22 +96,22 @@
} FTC_Image_Cache;
- /* a table of functions used to generate/manager glyph images */
- typedef struct FTC_Image_Class_
+ /* a table of functions used to generate/manager glyph images */
+ typedef struct FTC_Image_Class_
{
- FT_Error (*init_image)( FTC_Image_Queue queue,
- FTC_Image_Node node );
+ FT_Error (*init_image)( FTC_Image_Queue queue,
+ FTC_Image_Node node );
- void (*done_image)( FTC_Image_Queue queue,
- FTC_Image_Node node );
+ void (*done_image)( FTC_Image_Queue queue,
+ FTC_Image_Node node );
- FT_ULong (*size_image)( FTC_Image_Queue queue,
- FTC_Image_Node node );
+ FT_ULong (*size_image)( FTC_Image_Queue queue,
+ FTC_Image_Node node );
} FTC_Image_Class;
- typedef struct FTC_Image_QueueRec_
+ typedef struct FTC_Image_QueueRec_
{
FTC_Image_Cache cache;
FTC_Manager manager;
@@ -90,15 +124,25 @@
} FTC_Image_SubCacheRec;
- FT_EXPORT_DEF(FT_Error) FTC_Image_Cache_New( FTC_Manager manager,
- FT_ULong max_bytes,
- FTC_Image_Cache *acache );
+ FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_New( FTC_Manager manager,
+ FT_ULong max_bytes,
+ FTC_Image_Cache* acache );
- FT_EXPORT_DEF(void) FTC_Image_Cache_Done( FTC_Image_Cache cache );
+ FT_EXPORT_DEF( void ) FTC_Image_Cache_Done( FTC_Image_Cache cache );
- FT_EXPORT_DEF(FT_Error) FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
- FTC_Image_Desc* desc,
- FT_UInt gindex,
- FT_Glyph *aglyph );
+ FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_Lookup(
+ FTC_Image_Cache cache,
+ FTC_Image_Desc* desc,
+ FT_UInt gindex,
+ FT_Glyph* aglyph );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
#endif /* FTCIMAGE_H */
+
+
+/* END */
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 98453e1..d9af769 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -1,55 +1,82 @@
+/***************************************************************************/
+/* */
+/* ftcmanag.h */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 <cache/ftcmanag.h>
#include <freetype/internal/ftobjs.h>
-#define FTC_LRU_GET_MANAGER(lru) ((FTC_Manager_Lru)lru)->manager
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** FACE & SIZE LRU CALLBACKS *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
+#define FTC_LRU_GET_MANAGER( lru ) ((FTC_Manager_Lru)lru)->manager
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /***** *****/
+ /***** FACE & SIZE LRU CALLBACKS *****/
+ /***** *****/
+ /**************************************************************************/
+ /**************************************************************************/
static
FT_Error ftc_manager_init_face( FT_Lru lru,
FT_LruNode node )
{
- FTC_Manager manager = FTC_LRU_GET_MANAGER(lru);
+ FTC_Manager manager = FTC_LRU_GET_MANAGER( lru );
FT_Error error;
+
error = manager->request_face( (FTC_FaceID)node->key,
manager->request_data,
(FT_Face*)&node->root.data );
- if (!error)
+ if ( !error )
{
- /* destroy initial size object, it will be re-created later */
+ /* destroy initial size object; it will be re-created later */
FT_Face face = (FT_Face)node->root.data;
+
+
FT_Done_Size( face->size );
}
+
return error;
}
- /* helper function for ftc_manager_done_face */
- static
- FT_Bool ftc_manager_size_selector( FT_Lru lru,
- FT_LruNode node,
- FT_Pointer data )
- {
- FT_UNUSED(lru);
- return ((FT_Size)node->root.data)->face == (FT_Face)data;
- }
+ /* helper function for ftc_manager_done_face */
+ static
+ FT_Bool ftc_manager_size_selector( FT_Lru lru,
+ FT_LruNode node,
+ FT_Pointer data )
+ {
+ FT_UNUSED( lru );
+
+ return ((FT_Size)node->root.data)->face == (FT_Face)data;
+ }
+
static
- void ftc_manager_done_face( FT_Lru lru,
- FT_LruNode node )
+ void ftc_manager_done_face( FT_Lru lru,
+ FT_LruNode node )
{
- FTC_Manager manager = FTC_LRU_GET_MANAGER(lru);
+ FTC_Manager manager = FTC_LRU_GET_MANAGER( lru );
FT_Face face = (FT_Face)node->root.data;
+
/* we must begin by removing all sizes for the target face */
- /* from the manager's list.. */
+ /* from the manager's list */
FT_Lru_Remove_Selection( manager->sizes_lru,
ftc_manager_size_selector,
face );
@@ -60,7 +87,7 @@
}
- typedef struct FTC_SizeRequest_
+ typedef struct FTC_SizeRequest_
{
FT_Face face;
FT_UShort width;
@@ -70,24 +97,25 @@
static
- FT_Error ftc_manager_init_size( FT_Lru lru,
- FT_LruNode node )
+ FT_Error ftc_manager_init_size( FT_Lru lru,
+ FT_LruNode node )
{
FTC_SizeRequest* size_req = (FTC_SizeRequest*)node->key;
FT_Size size;
FT_Error error;
- FT_UNUSED(lru);
+ FT_UNUSED( lru );
+
node->root.data = 0;
error = FT_New_Size( size_req->face, &size );
- if (!error)
+ if ( !error )
{
error = FT_Set_Pixel_Sizes( size_req->face,
size_req->width,
size_req->height );
- if (error)
- FT_Done_Size(size);
+ if ( error )
+ FT_Done_Size( size );
else
node->root.data = size;
}
@@ -96,34 +124,35 @@
static
- void ftc_manager_done_size( FT_Lru lru,
- FT_LruNode node )
+ void ftc_manager_done_size( FT_Lru lru,
+ FT_LruNode node )
{
- FT_UNUSED(lru);
+ FT_UNUSED( lru );
+
FT_Done_Size( (FT_Size)node->root.data );
}
-
static
- FT_Error ftc_manager_flush_size( FT_Lru lru,
- FT_LruNode node,
- FT_LruKey key )
+ FT_Error ftc_manager_flush_size( FT_Lru lru,
+ FT_LruNode node,
+ FT_LruKey key )
{
FTC_SizeRequest* req = (FTC_SizeRequest*)key;
FT_Size size = (FT_Size)node->root.data;
FT_Error error;
+
if ( size->face == req->face )
{
size->face->size = size; /* set current size */
error = FT_Set_Pixel_Sizes( req->face, req->width, req->height );
- if (error)
+ if ( error )
FT_Done_Size( size );
}
else
{
- FT_Done_Size(size);
+ FT_Done_Size( size );
node->key = key;
error = ftc_manager_init_size( lru, node );
}
@@ -132,25 +161,25 @@
static
- FT_Bool ftc_manager_compare_size( FT_LruNode node,
- FT_LruKey key )
+ FT_Bool ftc_manager_compare_size( FT_LruNode node,
+ FT_LruKey key )
{
FTC_SizeRequest* req = (FTC_SizeRequest*)key;
FT_Size size = (FT_Size)node->root.data;
- FT_UNUSED(node);
- return ( size->face == req->face &&
- size->metrics.x_ppem == req->width &&
- size->metrics.y_ppem == req->height );
- }
+ FT_UNUSED( node );
+ return ( size->face == req->face &&
+ size->metrics.x_ppem == req->width &&
+ size->metrics.y_ppem == req->height );
+ }
static
const FT_Lru_Class ftc_face_lru_class =
{
- sizeof( FTC_Manager_LruRec ),
+ sizeof ( FTC_Manager_LruRec ),
ftc_manager_init_face,
ftc_manager_done_face,
0,
@@ -161,7 +190,7 @@
static
const FT_Lru_Class ftc_size_lru_class =
{
- sizeof( FTC_Manager_LruRec ),
+ sizeof ( FTC_Manager_LruRec ),
ftc_manager_init_size,
ftc_manager_done_size,
ftc_manager_flush_size,
@@ -169,18 +198,17 @@
};
-
- FT_EXPORT_FUNC(FT_Error) FTC_Manager_New ( FT_Library library,
+ FT_EXPORT_FUNC( FT_Error ) FTC_Manager_New( FT_Library library,
FTC_Face_Requester requester,
FT_Pointer req_data,
- FTC_Manager *amanager )
+ FTC_Manager* amanager )
{
FT_Error error;
FT_Memory memory = library->memory;
FTC_Manager manager = 0;
- if ( ALLOC( manager, sizeof(*manager) ) )
+ if ( ALLOC( manager, sizeof ( *manager ) ) )
goto Exit;
error = FT_Lru_New( &ftc_face_lru_class,
@@ -188,7 +216,7 @@
memory,
1, /* pre_alloc = TRUE */
(FT_Lru*)&manager->faces_lru );
- if (error)
+ if ( error )
goto Exit;
error = FT_Lru_New( &ftc_size_lru_class,
@@ -196,7 +224,7 @@
memory,
1, /* pre_alloc = TRUE */
(FT_Lru*)&manager->sizes_lru );
- if (error)
+ if ( error )
goto Exit;
((FTC_Manager_Lru)manager->faces_lru)->manager = manager;
@@ -208,7 +236,7 @@
*amanager = manager;
Exit:
- if (error && manager)
+ if ( error && manager )
{
FT_Lru_Done( manager->sizes_lru );
FT_Lru_Done( manager->faces_lru );
@@ -218,63 +246,68 @@
return error;
}
- FT_EXPORT_DEF(void) FTC_Manager_Done ( FTC_Manager manager )
+
+ FT_EXPORT_DEF( void ) FTC_Manager_Done( FTC_Manager manager )
{
FT_Memory memory = manager->library->memory;
+
FT_Lru_Done( manager->sizes_lru );
FT_Lru_Done( manager->faces_lru );
FREE( manager );
}
- FT_EXPORT_DEF(void) FTC_Manager_Reset( FTC_Manager manager )
+ FT_EXPORT_DEF( void ) FTC_Manager_Reset( FTC_Manager manager )
{
FT_Lru_Reset( manager->sizes_lru );
FT_Lru_Reset( manager->faces_lru );
}
- FT_EXPORT_DEF(FT_Error) FTC_Manager_Lookup_Face( FTC_Manager manager,
- FTC_FaceID face_id,
- FT_Face *aface )
+ FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Face( FTC_Manager manager,
+ FTC_FaceID face_id,
+ FT_Face* aface )
{
return FT_Lru_Lookup( manager->faces_lru,
- (FT_LruKey)face_id,
- (FT_Pointer*)aface );
+ (FT_LruKey)face_id,
+ (FT_Pointer*)aface );
}
-
- FT_EXPORT_DEF(FT_Error) FTC_Manager_Lookup_Size( FTC_Manager manager,
- FTC_SizeID size_id,
- FT_Face *aface,
- FT_Size *asize )
+ FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager,
+ FTC_SizeID size_id,
+ FT_Face* aface,
+ FT_Size* asize )
{
FTC_SizeRequest req;
FT_Error error;
FT_Face face;
+
*aface = 0;
*asize = 0;
+
error = FTC_Manager_Lookup_Face( manager, size_id->face_id, &face );
- if (!error)
+ if ( !error )
{
req.face = face;
req.width = size_id->pix_width;
req.height = size_id->pix_height;
- error = FT_Lru_Lookup( manager->sizes_lru,
- (FT_LruKey)&req,
- (FT_Pointer*)asize );
- if (!error)
+ error = FT_Lru_Lookup( manager->sizes_lru,
+ (FT_LruKey)&req,
+ (FT_Pointer*)asize );
+ if ( !error )
{
/* select the size as the current one for this face */
face->size = *asize;
*aface = face;
}
}
+
return error;
}
+/* END */
diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h
index e000e09..b765ed4 100644
--- a/src/cache/ftcmanag.h
+++ b/src/cache/ftcmanag.h
@@ -1,30 +1,55 @@
+/***************************************************************************/
+/* */
+/* ftcmanag.h */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 FTCMANAG_H
#define FTCMANAG_H
#include <cache/ftlru.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
#define FTC_MAX_FACES 4
#define FTC_MAX_SIZES 8
+
typedef FT_Pointer FTC_FaceID;
- typedef struct FTC_SizeRec_
+ typedef struct FTC_SizeRec_
{
- FTC_FaceID face_id;
- FT_UShort pix_width;
- FT_UShort pix_height;
+ FTC_FaceID face_id;
+ FT_UShort pix_width;
+ FT_UShort pix_height;
} FTC_SizeRec, *FTC_SizeID;
typedef FT_Error (*FTC_Face_Requester)( FTC_FaceID face_id,
FT_Pointer data,
- FT_Face *aface );
+ FT_Face* aface );
typedef struct FTC_ManagerRec_* FTC_Manager;
- typedef struct FTC_Manager_LruRec_
+ typedef struct FTC_Manager_LruRec_
{
FT_LruRec root;
FTC_Manager manager;
@@ -32,7 +57,7 @@
} FTC_Manager_LruRec, *FTC_Manager_Lru;
- typedef struct FTC_ManagerRec_
+ typedef struct FTC_ManagerRec_
{
FT_Library library;
FT_Lru faces_lru;
@@ -44,22 +69,31 @@
} FTC_ManagerRec;
- FT_EXPORT_DEF(FT_Error) FTC_Manager_New ( FT_Library library,
+ FT_EXPORT_DEF( FT_Error ) FTC_Manager_New( FT_Library library,
FTC_Face_Requester requester,
FT_Pointer req_data,
- FTC_Manager *amanager );
+ FTC_Manager* amanager );
- FT_EXPORT_DEF(void) FTC_Manager_Done ( FTC_Manager manager );
+ FT_EXPORT_DEF( void ) FTC_Manager_Done( FTC_Manager manager );
- FT_EXPORT_DEF(void) FTC_Manager_Reset( FTC_Manager manager );
+ FT_EXPORT_DEF( void ) FTC_Manager_Reset( FTC_Manager manager );
- FT_EXPORT_DEF(FT_Error) FTC_Manager_Lookup_Face( FTC_Manager manager,
- FTC_FaceID face_id,
- FT_Face *aface );
+ FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Face( FTC_Manager manager,
+ FTC_FaceID face_id,
+ FT_Face* aface );
- FT_EXPORT_DEF(FT_Error) FTC_Manager_Lookup_Size( FTC_Manager manager,
- FTC_SizeID size_id,
- FT_Face *aface,
- FT_Size *asize );
+ FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager,
+ FTC_SizeID size_id,
+ FT_Face* aface,
+ FT_Size* asize );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
#endif /* FTCMANAG_H */
+
+
+/* END */
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index d9a619a..c830b96 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -1,7 +1,26 @@
+/***************************************************************************/
+/* */
+/* ftlru.c */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 <cache/ftlru.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftlist.h>
+
static
void lru_build_free_list( FT_LruNode nodes,
FT_UInt count,
@@ -10,25 +29,27 @@
FT_LruNode node = nodes;
FT_LruNode limit = node + count;
+
free_list->head = free_list->tail = 0;
for ( ; node < limit; node++ )
FT_List_Add( free_list, (FT_ListNode)node );
}
- FT_EXPORT_FUNC(FT_Error) FT_Lru_New ( const FT_Lru_Class* clazz,
- FT_UInt max_elements,
- FT_Memory memory,
- FT_Bool pre_alloc,
- FT_Lru *alru )
+ FT_EXPORT_FUNC( FT_Error ) FT_Lru_New( const FT_Lru_Class* clazz,
+ FT_UInt max_elements,
+ FT_Memory memory,
+ FT_Bool pre_alloc,
+ FT_Lru* alru )
{
FT_Error error;
FT_Lru lru;
+
*alru = 0;
- if ( !ALLOC( lru, sizeof(*lru) ) )
+ if ( !ALLOC( lru, sizeof ( *lru ) ) )
{
- if (pre_alloc)
+ if ( pre_alloc )
{
/* allocate static array of lru list nodes */
if ( ALLOC_ARRAY( lru->nodes, max_elements, FT_LruNodeRec ) )
@@ -37,7 +58,7 @@
goto Exit;
}
- /* build the 'free_nodes' list from the array */
+ /* build the `free_nodes' list from the array */
lru_build_free_list( lru->nodes, max_elements, &lru->free_nodes );
}
@@ -45,53 +66,57 @@
lru->clazz = (FT_Lru_Class*)clazz;
lru->max_elements = max_elements;
lru->memory = memory;
+
*alru = lru;
}
+
Exit:
return error;
}
- FT_EXPORT_DEF(void) FT_Lru_Reset ( FT_Lru lru )
+ FT_EXPORT_DEF( void ) FT_Lru_Reset( FT_Lru lru )
{
FT_ListNode node = lru->elements.head;
FT_Lru_Class* clazz = lru->clazz;
FT_Memory memory = lru->memory;
- while (node)
+
+ while ( node )
{
FT_ListNode next = node->next;
+
clazz->done_element( lru, (FT_LruNode)node );
- if (!lru->nodes)
- FREE(node);
+ if ( !lru->nodes )
+ FREE( node );
node = next;
}
/* rebuild free list if necessary */
- if (lru->nodes)
+ if ( lru->nodes )
lru_build_free_list( lru->nodes, lru->max_elements, &lru->free_nodes );
- lru->elements.head = lru->elements.tail = 0;
+
+ lru->elements.head = lru->elements.tail = 0;
lru->num_elements = 0;
}
-
- FT_EXPORT_DEF(void) FT_Lru_Done ( FT_Lru lru )
+ FT_EXPORT_DEF( void ) FT_Lru_Done( FT_Lru lru )
{
FT_Memory memory = lru->memory;
- FT_Lru_Reset(lru);
- FREE(lru);
- }
+ FT_Lru_Reset( lru );
+ FREE( lru );
+ }
- FT_EXPORT_DEF(FT_Error) FT_Lru_Lookup_Node( FT_Lru lru,
- FT_LruKey key,
- FT_LruNode* anode )
+ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup_Node( FT_Lru lru,
+ FT_LruKey key,
+ FT_LruNode* anode )
{
FT_Error error = 0;
FT_ListNode node = lru->elements.head;
@@ -99,10 +124,11 @@
FT_LruNode found = 0;
FT_Memory memory = lru->memory;
- if (clazz->compare_element)
+
+ if ( clazz->compare_element )
{
for ( ; node; node = node->next )
- if (clazz->compare_element( (FT_LruNode)node, key ))
+ if ( clazz->compare_element( (FT_LruNode)node, key ) )
{
found = (FT_LruNode)node;
break;
@@ -111,20 +137,20 @@
else
{
for ( ; node; node = node->next )
- if (((FT_LruNode)node)->key == key)
+ if ( ((FT_LruNode)node)->key == key )
{
found = (FT_LruNode)node;
break;
}
}
- if (!found)
+ if ( !found )
{
- /* we didn't find the relevant element. We will now try */
- /* to create a new one.. */
+ /* we haven't found the relevant element. We will now try */
+ /* to create a new one. */
if ( lru->num_elements >= lru->max_elements )
{
- /* this lru list is full, we will now flush */
+ /* this lru list is full; we will now flush */
/* the oldest node */
FT_LruNode lru_node;
@@ -132,7 +158,7 @@
node = lru->elements.tail;
lru_node = (FT_LruNode)node;
- if (clazz->flush_element)
+ if ( clazz->flush_element )
error = clazz->flush_element( lru, lru_node, key );
else
{
@@ -142,7 +168,7 @@
error = clazz->init_element( lru, lru_node );
}
- if (!error)
+ if ( !error )
{
/* now, move element to top of list */
FT_List_Up( &lru->elements, node );
@@ -153,7 +179,7 @@
FT_List_Remove( &lru->elements, node );
lru->num_elements--;
- if (lru->nodes)
+ if ( lru->nodes )
FT_List_Insert( &lru->free_nodes, node );
else
FREE( lru_node );
@@ -163,27 +189,28 @@
{
FT_LruNode lru_node;
+
/* create a new lru list node, then the element for it */
- if (lru->nodes)
+ if ( lru->nodes )
{
node = lru->free_nodes.head;
lru_node = (FT_LruNode)node;
lru_node->key = key;
error = clazz->init_element( lru, lru_node );
- if (error)
+ if ( error )
goto Exit;
FT_List_Remove( &lru->free_nodes, node );
}
else
{
- if ( ALLOC( lru_node, sizeof(*lru_node) ) )
+ if ( ALLOC( lru_node, sizeof ( *lru_node ) ) )
goto Exit;
lru_node->key = key;
error = clazz->init_element( lru, lru_node );
- if (error)
+ if ( error )
{
FREE( lru_node );
goto Exit;
@@ -203,52 +230,57 @@
}
- FT_EXPORT_DEF(FT_Error) FT_Lru_Lookup( FT_Lru lru,
- FT_LruKey key,
- FT_Pointer *aobject )
+ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup( FT_Lru lru,
+ FT_LruKey key,
+ FT_Pointer* aobject )
{
FT_Error error;
FT_LruNode node;
+
*aobject = 0;
error = FT_Lru_Lookup_Node( lru, key, &node );
- if (!error)
+ if ( !error )
*aobject = node->root.data;
return error;
}
- FT_EXPORT_FUNC(void) FT_Lru_Remove_Node( FT_Lru lru,
- FT_LruNode node )
+ FT_EXPORT_FUNC( void ) FT_Lru_Remove_Node( FT_Lru lru,
+ FT_LruNode node )
{
- if (lru->num_elements > 0)
+ if ( lru->num_elements > 0 )
{
FT_List_Remove( &lru->elements, (FT_ListNode)node );
lru->clazz->done_element( lru, node );
- if (lru->nodes)
+ if ( lru->nodes )
FT_List_Insert( &lru->free_nodes, (FT_ListNode)node );
else
{
FT_Memory memory = lru->memory;
- FREE(node);
+
+
+ FREE( node );
}
+
lru->num_elements--;
}
}
- FT_EXPORT_FUNC(void) FT_Lru_Remove_Selection( FT_Lru lru,
- FT_Lru_Selector selector,
- FT_Pointer data )
+ FT_EXPORT_FUNC( void ) FT_Lru_Remove_Selection( FT_Lru lru,
+ FT_Lru_Selector selector,
+ FT_Pointer data )
{
- if (lru->num_elements > 0)
+ if ( lru->num_elements > 0 )
{
- FT_ListNode node = lru->elements.head;
- FT_ListNode next;
+ FT_ListNode node = lru->elements.head;
+ FT_ListNode next;
+
- while (node)
+ while ( node )
{
next = node->next;
if ( selector( lru, (FT_LruNode)node, data ) )
@@ -261,3 +293,5 @@
}
}
+
+/* END */
diff --git a/src/cache/ftlru.h b/src/cache/ftlru.h
index c61f89b..28054c8 100644
--- a/src/cache/ftlru.h
+++ b/src/cache/ftlru.h
@@ -1,13 +1,36 @@
+/***************************************************************************/
+/* */
+/* ftlru.h */
+/* */
+/* XXX */
+/* */
+/* Copyright 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 FTLRU_H
#define FTLRU_H
#include <freetype/freetype.h>
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
typedef FT_Pointer FT_LruKey;
- typedef struct FT_LruNodeRec_
+ typedef struct FT_LruNodeRec_
{
FT_ListNodeRec root;
FT_LruKey key;
@@ -17,22 +40,23 @@
typedef struct FT_LruRec_* FT_Lru;
- typedef struct FT_Lru_Class_
+ typedef struct FT_Lru_Class_
{
- FT_UInt lru_size; /* object size in bytes */
+ FT_UInt lru_size; /* object size in bytes */
- FT_Error (*init_element)( FT_Lru lru,
- FT_LruNode node );
+ FT_Error (*init_element)( FT_Lru lru,
+ FT_LruNode node );
- void (*done_element)( FT_Lru lru,
- FT_LruNode node );
+ void (*done_element)( FT_Lru lru,
+ FT_LruNode node );
- FT_Error (*flush_element)( FT_Lru lru,
- FT_LruNode node,
- FT_LruKey new_key );
+ FT_Error (*flush_element)( FT_Lru lru,
+ FT_LruNode node,
+ FT_LruKey new_key );
- FT_Bool (*compare_element)( FT_LruNode node,
- FT_LruKey key );
+ FT_Bool (*compare_element)( FT_LruNode node,
+ FT_LruKey key );
+
} FT_Lru_Class;
@@ -40,7 +64,8 @@
FT_LruNode node,
FT_Pointer data );
- typedef struct FT_LruRec_
+
+ typedef struct FT_LruRec_
{
FT_Lru_Class* clazz;
FT_UInt max_elements;
@@ -55,29 +80,38 @@
} FT_LruRec;
- FT_EXPORT_DEF(FT_Error) FT_Lru_New ( const FT_Lru_Class* clazz,
- FT_UInt max_elements,
- FT_Memory memory,
- FT_Bool pre_alloc,
- FT_Lru *alru );
+ FT_EXPORT_DEF( FT_Error ) FT_Lru_New( const FT_Lru_Class* clazz,
+ FT_UInt max_elements,
+ FT_Memory memory,
+ FT_Bool pre_alloc,
+ FT_Lru* alru );
- FT_EXPORT_DEF(void) FT_Lru_Reset ( FT_Lru lru );
+ FT_EXPORT_DEF( void ) FT_Lru_Reset( FT_Lru lru );
- FT_EXPORT_DEF(void) FT_Lru_Done ( FT_Lru lru );
+ FT_EXPORT_DEF( void ) FT_Lru_Done( FT_Lru lru );
- FT_EXPORT_DEF(FT_Error) FT_Lru_Lookup_Node( FT_Lru lru,
- FT_LruKey key,
- FT_LruNode* anode );
+ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup_Node( FT_Lru lru,
+ FT_LruKey key,
+ FT_LruNode* anode );
- FT_EXPORT_DEF(FT_Error) FT_Lru_Lookup( FT_Lru lru,
- FT_LruKey key,
- FT_Pointer *aobject );
+ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup( FT_Lru lru,
+ FT_LruKey key,
+ FT_Pointer* aobject );
- FT_EXPORT_DEF(void) FT_Lru_Remove_Node( FT_Lru lru,
- FT_LruNode node );
+ FT_EXPORT_DEF( void ) FT_Lru_Remove_Node( FT_Lru lru,
+ FT_LruNode node );
+
+ FT_EXPORT_DEF( void ) FT_Lru_Remove_Selection( FT_Lru lru,
+ FT_Lru_Selector selector,
+ FT_Pointer data );
+
+
+#ifdef __cplusplus
+ }
+#endif
- FT_EXPORT_DEF(void) FT_Lru_Remove_Selection( FT_Lru lru,
- FT_Lru_Selector selector,
- FT_Pointer data );
#endif /* FTLRU_H */
+
+
+/* END */
diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c
index 60af03a..07f5238 100644
--- a/src/psaux/psaux.c
+++ b/src/psaux/psaux.c
@@ -1,3 +1,21 @@
+/***************************************************************************/
+/* */
+/* psaux.c */
+/* */
+/* FreeType auxiliary PostScript driver component (body only). */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
#define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE
@@ -14,3 +32,5 @@
#endif
+
+/* END */
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 1923d9e..1c47af0 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -45,7 +45,7 @@
/* PS_Table_New */
/* */
/* <Description> */
- /* Initialises a PS_Table. */
+ /* Initializes a PS_Table. */
/* */
/* <InOut> */
/* table :: The address of the target table. */
@@ -1137,7 +1137,8 @@
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
- if (builder->shift)
+
+ if ( builder->shift )
{
x >>= 16;
y >>= 16;
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index 29c9c17..e01292c 100644
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -36,10 +36,10 @@
/*************************************************************************/
LOCAL_DEF
- const PS_Table_Funcs ps_table_funcs;
+ const PS_Table_Funcs ps_table_funcs;
LOCAL_DEF
- const T1_Parser_Funcs t1_parser_funcs;
+ const T1_Parser_Funcs t1_parser_funcs;
LOCAL_DEF
const T1_Builder_Funcs t1_builder_funcs;
@@ -56,11 +56,11 @@
FT_Int length );
LOCAL_DEF
- void PS_Table_Done( PS_Table* table );
+ void PS_Table_Done( PS_Table* table );
LOCAL_DEF
- void PS_Table_Release( PS_Table* table );
+ void PS_Table_Release( PS_Table* table );
/*************************************************************************/
@@ -124,13 +124,13 @@
LOCAL_DEF
- void T1_Init_Parser( T1_Parser* parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory );
+ void T1_Init_Parser( T1_Parser* parser,
+ FT_Byte* base,
+ FT_Byte* limit,
+ FT_Memory memory );
LOCAL_DEF
- void T1_Done_Parser( T1_Parser* parser );
+ void T1_Done_Parser( T1_Parser* parser );
/*************************************************************************/
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 9399528..0aa7cc6 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -1,8 +1,27 @@
+/***************************************************************************/
+/* */
+/* t1decode.c */
+/* */
+/* PostScript Type 1 decoding routines (body). */
+/* */
+/* Copyright 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 <psaux/t1decode.h>
#include <psaux/psobjs.h>
#include <freetype/internal/t1errors.h>
#include <freetype/ftoutln.h>
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -81,11 +100,11 @@
/*************************************************************************/
/* */
/* <Function> */
- /* lookup_glyph_by_stdcharcode */
+ /* t1_lookup_glyph_by_stdcharcode */
/* */
/* <Description> */
- /* Looks up a given glyph by its StandardEncoding charcode. Used */
- /* to implement the SEAC Type 1 operator. */
+ /* Looks up a given glyph by its StandardEncoding charcode. Used to */
+ /* implement the SEAC Type 1 operator. */
/* */
/* <Input> */
/* face :: The current face object. */
@@ -254,6 +273,7 @@
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
+
FT_Outline_Translate( &dummy, adx - asb, ady );
}
@@ -262,7 +282,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -279,7 +298,7 @@
/* charstring_len :: The length in bytes of the charstring stream. */
/* */
/* <Return> */
- /* Free error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
@@ -294,13 +313,14 @@
FT_Outline* outline;
FT_Pos x, y;
+
/* we don't want to touch the source code -- use macro trick */
-#define start_point T1_Builder_Start_Point
-#define check_points T1_Builder_Check_Points
-#define add_point T1_Builder_Add_Point
-#define add_point1 T1_Builder_Add_Point1
-#define add_contour T1_Builder_Add_Contour
-#define close_contour T1_Builder_Close_Contour
+#define start_point T1_Builder_Start_Point
+#define check_points T1_Builder_Check_Points
+#define add_point T1_Builder_Add_Point
+#define add_point1 T1_Builder_Add_Point1
+#define add_contour T1_Builder_Add_Contour
+#define close_contour T1_Builder_Close_Contour
/* First of all, initialize the decoder */
decoder->top = decoder->stack;
@@ -897,7 +917,7 @@
case op_pop:
FT_TRACE4(( " pop" ));
- /* theorically, the arguments are already on the stack */
+ /* theoretically, the arguments are already on the stack */
top++;
break;
@@ -990,17 +1010,19 @@
T1_Blend* blend,
T1_Decoder_Callback parse_callback )
{
- MEM_Set( decoder, 0, sizeof(*decoder) );
+ MEM_Set( decoder, 0, sizeof ( *decoder ) );
/* retrieve PSNames interface from list of current modules */
{
PSNames_Interface* psnames = 0;
+
psnames = (PSNames_Interface*)FT_Get_Module_Interface(
FT_FACE_LIBRARY(face), "psnames" );
- if (!psnames)
+ if ( !psnames )
{
- FT_ERROR(( "T1_Decoder_Init: the 'psnames' module is not available\n" ));
+ FT_ERROR(( "T1_Decoder_Init: " ));
+ FT_ERROR(( "the `psnames' module is not available\n" ));
return FT_Err_Unimplemented_Feature;
}
@@ -1014,6 +1036,7 @@
decoder->parse_callback = parse_callback;
decoder->funcs = t1_decoder_funcs;
+
return 0;
}
@@ -1024,3 +1047,5 @@
T1_Builder_Done( &decoder->builder );
}
+
+/* END */
diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h
index 3898b29..d14a7f0 100644
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -1,3 +1,21 @@
+/***************************************************************************/
+/* */
+/* t1decode.h */
+/* */
+/* PostScript Type 1 decoding routines (specification). */
+/* */
+/* Copyright 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 T1DECODE_H
#define T1DECODE_H
@@ -5,17 +23,18 @@
#include <freetype/internal/psnames.h>
#include <freetype/internal/t1types.h>
+
LOCAL_DEF
- const T1_Decoder_Funcs t1_decoder_funcs;
+ const T1_Decoder_Funcs t1_decoder_funcs;
LOCAL_DEF
- FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
- FT_UInt glyph_index );
+ FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
+ FT_UInt glyph_index );
LOCAL_DEF
- FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
- FT_Byte* base,
- FT_UInt len );
+ FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
+ FT_Byte* base,
+ FT_UInt len );
LOCAL_DEF
FT_Error T1_Decoder_Init( T1_Decoder* decoder,
@@ -29,4 +48,8 @@
LOCAL_DEF
void T1_Decoder_Done( T1_Decoder* decoder );
+
#endif /* T1DECODE_H */
+
+
+/* END */
diff --git a/src/type1z/z1gload.c b/src/type1z/z1gload.c
index 98d3f96..59072ba 100644
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -46,7 +46,6 @@
#define FT_COMPONENT trace_z1gload
-
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -68,14 +67,17 @@
FT_Error Z1_Parse_Glyph( T1_Decoder* decoder,
FT_UInt glyph_index )
{
- T1_Face face = (T1_Face)decoder->builder.face;
- T1_Font* type1 = &face->type1;
+ T1_Face face = (T1_Face)decoder->builder.face;
+ T1_Font* type1 = &face->type1;
- return decoder->funcs.parse_charstrings( decoder,
- type1->charstrings [glyph_index],
- type1->charstrings_len[glyph_index] );
+
+ return decoder->funcs.parse_charstrings(
+ decoder,
+ type1->charstrings [glyph_index],
+ type1->charstrings_len[glyph_index] );
}
+
LOCAL_FUNC
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance )
@@ -89,7 +91,7 @@
*max_advance = 0;
- /* Initialize load decoder */
+ /* initialize load decoder */
error = psaux->t1_decoder_funcs->init( &decoder,
(FT_Face)face,
0, /* size */
@@ -172,10 +174,10 @@
(FT_Byte**)type1->glyph_names,
face->blend,
Z1_Parse_Glyph );
- if (error)
+ if ( error )
goto Exit;
- decoder.builder.no_recurse = ( load_flags & FT_LOAD_NO_RECURSE ) != 0;
+ decoder.builder.no_recurse = ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;
@@ -184,7 +186,7 @@
/* now load the unscaled outline */
error = Z1_Parse_Glyph( &decoder, glyph_index );
- if (error)
+ if ( error )
goto Exit;
/* save new glyph tables */
@@ -207,8 +209,8 @@
}
else
{
- FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &glyph->root.metrics;
+ FT_BBox cbox;
+ FT_Glyph_Metrics* metrics = &glyph->root.metrics;
/* copy the _unscaled_ advance width */
@@ -233,9 +235,11 @@
face->type1.font_offset.y );
#if 0
+
glyph->root.outline.second_pass = TRUE;
glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
glyph->root.outline.dropout_mode = 2;
+
#endif /* 0 */
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
@@ -284,6 +288,7 @@
metrics->horiBearingY = cbox.yMax;
}
}
+
Exit:
return error;
}
diff --git a/src/type1z/z1gload.h b/src/type1z/z1gload.h
index de7b8dc..c9a913b 100644
--- a/src/type1z/z1gload.h
+++ b/src/type1z/z1gload.h
@@ -36,7 +36,6 @@
#endif
-
LOCAL_DEF
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance );
diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c
index 5fcac8c..98f76cf 100644
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -393,11 +393,11 @@
void parse_blend_axis_types( T1_Face face,
Z1_Loader* loader )
{
- T1_Token axis_tokens[ T1_MAX_MM_AXIS ];
- FT_Int n, num_axis;
- FT_Error error = 0;
- T1_Blend* blend;
- FT_Memory memory;
+ T1_Token axis_tokens[ T1_MAX_MM_AXIS ];
+ FT_Int n, num_axis;
+ FT_Error error = 0;
+ T1_Blend* blend;
+ FT_Memory memory;
/* take an array of objects */
@@ -423,8 +423,8 @@
for ( n = 0; n < num_axis; n++ )
{
T1_Token* token = axis_tokens + n;
- FT_Byte* name;
- FT_Int len;
+ FT_Byte* name;
+ FT_Int len;
/* skip first slash, if any */
if (token->start[0] == '/')
@@ -454,13 +454,13 @@
void parse_blend_design_positions( T1_Face face,
Z1_Loader* loader )
{
- T1_Token design_tokens[ T1_MAX_MM_DESIGNS ];
- FT_Int num_designs;
- FT_Int num_axis;
- Z1_Parser* parser = &loader->parser;
+ T1_Token design_tokens[ T1_MAX_MM_DESIGNS ];
+ FT_Int num_designs;
+ FT_Int num_axis;
+ Z1_Parser* parser = &loader->parser;
- FT_Error error = 0;
- T1_Blend* blend;
+ FT_Error error = 0;
+ T1_Blend* blend;
/* get the array of design tokens - compute number of designs */
@@ -536,14 +536,14 @@
void parse_blend_design_map( T1_Face face,
Z1_Loader* loader )
{
- FT_Error error = 0;
- Z1_Parser* parser = &loader->parser;
- T1_Blend* blend;
- T1_Token axis_tokens[ T1_MAX_MM_AXIS ];
- FT_Int n, num_axis;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
- FT_Memory memory = face->root.memory;
+ FT_Error error = 0;
+ Z1_Parser* parser = &loader->parser;
+ T1_Blend* blend;
+ T1_Token axis_tokens[ T1_MAX_MM_AXIS ];
+ FT_Int n, num_axis;
+ FT_Byte* old_cursor;
+ FT_Byte* old_limit;
+ FT_Memory memory = face->root.memory;
Z1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &num_axis );
@@ -565,9 +565,9 @@
/* now, read each axis design map */
for ( n = 0; n < num_axis; n++ )
{
- T1_DesignMap* map = blend->design_map + n;
- T1_Token* token;
- FT_Int p, num_points;
+ T1_DesignMap* map = blend->design_map + n;
+ T1_Token* token;
+ FT_Int p, num_points;
token = axis_tokens + n;
@@ -617,13 +617,13 @@
void parse_weight_vector( T1_Face face,
Z1_Loader* loader )
{
- FT_Error error = 0;
- Z1_Parser* parser = &loader->parser;
- T1_Blend* blend = face->blend;
- T1_Token master;
- FT_UInt n;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
+ FT_Error error = 0;
+ Z1_Parser* parser = &loader->parser;
+ T1_Blend* blend = face->blend;
+ T1_Token master;
+ FT_UInt n;
+ FT_Byte* old_cursor;
+ FT_Byte* old_limit;
if ( !blend || blend->num_designs == 0 )
@@ -693,48 +693,48 @@
/*************************************************************************/
/* */
/* First of all, define the token field static variables. This is a set */
- /* of T1_Field variables used later. */
+ /* of T1_Field variables used later. */
/* */
/*************************************************************************/
-#define Z1_NEW_STRING( _name, _field ) \
- static \
+#define Z1_NEW_STRING( _name, _field ) \
+ static \
const T1_Field z1_field_ ## _field = \
T1_FIELD_STRING( _field );
-#define Z1_NEW_BOOL( _name, _field ) \
- static \
+#define Z1_NEW_BOOL( _name, _field ) \
+ static \
const T1_Field z1_field_ ## _field = \
T1_FIELD_BOOL( _field );
-#define Z1_NEW_NUM( _name, _field ) \
- static \
+#define Z1_NEW_NUM( _name, _field ) \
+ static \
const T1_Field z1_field_ ## _field = \
T1_FIELD_NUM( _field );
-#define Z1_NEW_FIXED( _name, _field ) \
- static \
- const T1_Field z1_field_ ## _field = \
+#define Z1_NEW_FIXED( _name, _field ) \
+ static \
+ const T1_Field z1_field_ ## _field = \
T1_FIELD_FIXED( _field, _power );
-#define Z1_NEW_NUM_TABLE( _name, _field, _max, _count ) \
- static \
- const T1_Field z1_field_ ## _field = \
+#define Z1_NEW_NUM_TABLE( _name, _field, _max, _count ) \
+ static \
+ const T1_Field z1_field_ ## _field = \
T1_FIELD_NUM_ARRAY( _field, _count, _max );
-#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
- static \
- const T1_Field z1_field_ ## _field = \
+#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
+ static \
+ const T1_Field z1_field_ ## _field = \
T1_FIELD_FIXED_ARRAY( _field, _count, _max );
-#define Z1_NEW_NUM_TABLE2( _name, _field, _max ) \
- static \
- const T1_Field z1_field_ ## _field = \
+#define Z1_NEW_NUM_TABLE2( _name, _field, _max ) \
+ static \
+ const T1_Field z1_field_ ## _field = \
T1_FIELD_NUM_ARRAY2( _field, _max );
-#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
- static \
- const T1_Field z1_field_ ## _field = \
+#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
+ static \
+ const T1_Field z1_field_ ## _field = \
T1_FIELD_FIXED_ARRAY2( _field, _max );
@@ -796,7 +796,7 @@
Z1_KeyWord_Type type;
Z1_KeyWord_Location location;
Z1_Parse_Func parsing;
- const T1_Field* field;
+ const T1_Field* field;
} Z1_KeyWord;
@@ -924,14 +924,14 @@
static
int is_space( FT_Byte c )
{
- return (c == ' ' || c == '\t' || c == '\r' || c == '\n' );
+ return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' );
}
static
int is_alpha( FT_Byte c )
{
- return (isalnum(c) || c == '.' || c == '_' );
+ return ( isalnum( c ) || c == '.' || c == '_' );
}
@@ -964,7 +964,7 @@
/* `RD' or `-|' token */
*base = parser->root.cursor + 1;
- parser->root.cursor += *size+1;
+ parser->root.cursor += *size + 1;
return 1;
}
@@ -1114,9 +1114,10 @@
/* we use a Z1_Table to store our charnames */
encode->num_chars = count;
- if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) ||
- ALLOC_ARRAY( encode->char_name, count, FT_String* ) ||
- ( error = psaux->ps_table_funcs->init( char_table, count, memory ) ) != 0 )
+ if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) ||
+ ALLOC_ARRAY( encode->char_name, count, FT_String* ) ||
+ ( error = psaux->ps_table_funcs->init(
+ char_table, count, memory ) ) != 0 )
{
parser->root.error = error;
return;
@@ -1200,7 +1201,7 @@
}
face->type1.encoding_type = t1_encoding_array;
- parser->root.cursor = cur;
+ parser->root.cursor = cur;
}
/* Otherwise, we should have either `StandardEncoding' or */
/* `ExpertEncoding' */
@@ -1234,6 +1235,7 @@
FT_Int n;
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
+
loader->num_subrs = Z1_ToInt( parser );
if ( parser->root.error )
@@ -1333,11 +1335,15 @@
return;
/* initialize tables */
- error = psaux->ps_table_funcs->init( code_table, loader->num_glyphs, memory );
- if (error)
+ error = psaux->ps_table_funcs->init( code_table,
+ loader->num_glyphs,
+ memory );
+ if ( error )
goto Fail;
- error = psaux->ps_table_funcs->init( name_table, loader->num_glyphs, memory );
+ error = psaux->ps_table_funcs->init( name_table,
+ loader->num_glyphs,
+ memory );
if ( error )
goto Fail;
@@ -1555,7 +1561,9 @@
/* we found it -- run the parsing callback! */
parser->root.cursor = cur2;
Z1_Skip_Spaces( parser );
- parser->root.error = t1_load_keyword( face, loader, keyword );
+ parser->root.error = t1_load_keyword( face,
+ loader,
+ keyword );
if ( parser->root.error )
return parser->root.error;
@@ -1620,13 +1628,17 @@
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
+
t1_init_loader( &loader, face );
/* default lenIV */
type1->private_dict.lenIV = 4;
parser = &loader.parser;
- error = Z1_New_Parser( parser, face->root.stream, face->root.memory, psaux );
+ error = Z1_New_Parser( parser,
+ face->root.stream,
+ face->root.memory,
+ psaux );
if ( error )
goto Exit;
diff --git a/src/type1z/z1objs.c b/src/type1z/z1objs.c
index ec8509f..4a6ea3d 100644
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -179,7 +179,7 @@
}
psaux = (PSAux_Interface*)face->psaux;
- if (!psaux)
+ if ( !psaux )
{
psaux = (PSAux_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" );
diff --git a/src/type1z/z1parse.c b/src/type1z/z1parse.c
index 86c6180..07e7a15 100644
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -81,7 +81,7 @@
#define IS_Z1_SPACE( c ) ( IS_Z1_WHITESPACE( c ) || IS_Z1_LINESPACE( c ) )
- typedef struct PFB_Tag_
+ typedef struct PFB_Tag_
{
FT_UShort tag;
FT_Long size;
@@ -92,10 +92,11 @@
#undef FT_STRUCTURE
#define FT_STRUCTURE PFB_Tag
+
static
const FT_Frame_Field pfb_tag_fields[] =
{
- FT_FRAME_START(6),
+ FT_FRAME_START( 6 ),
FT_FRAME_USHORT ( tag ),
FT_FRAME_LONG_LE( size ),
FT_FRAME_END
@@ -110,6 +111,7 @@
FT_Error error;
PFB_Tag head;
+
*tag = 0;
*size = 0;
if ( !READ_Fields( pfb_tag_fields, &head ) )
@@ -130,9 +132,10 @@
FT_Memory memory,
PSAux_Interface* psaux )
{
- FT_Error error;
- FT_UShort tag;
- FT_Long size;
+ FT_Error error;
+ FT_UShort tag;
+ FT_Long size;
+
psaux->t1_parser_funcs->init( &parser->root,0, 0, memory );
@@ -253,7 +256,7 @@
static
int hexa_value( char c )
{
- unsigned int d;
+ unsigned int d;
d = (unsigned int)( c - '0' );
diff --git a/src/type1z/z1parse.h b/src/type1z/z1parse.h
index 2531702..2615382 100644
--- a/src/type1z/z1parse.h
+++ b/src/type1z/z1parse.h
@@ -37,9 +37,9 @@
/* quickly. */
/* */
/* <Fields> */
- /* stream :: The current input stream. */
+ /* root :: The root parser. */
/* */
- /* memory :: The current memory object. */
+ /* stream :: The current input stream. */
/* */
/* base_dict :: A pointer to the top-level dictionary. */
/* */
@@ -57,13 +57,6 @@
/* single_block :: A boolean. Indicates that the private dictionary */
/* is stored in lieu of the base dictionary. */
/* */
- /* cursor :: The current parser cursor. */
- /* */
- /* limit :: The current parser limit (first byte after the */
- /* current dictionary). */
- /* */
- /* error :: The current parsing error. */
- /* */
typedef struct Z1_Parser_
{
T1_Parser root;
@@ -82,24 +75,41 @@
} Z1_Parser;
-#define Z1_Add_Table(p,i,o,l) (p)->funcs.add( (p), i, o, l )
-#define Z1_Done_Table(p) do { if ((p)->funcs.done) (p)->funcs.done( p ); } while (0)
-#define Z1_Release_Table(p) do { if ((p)->funcs.release) (p)->funcs.release( p ); } while (0)
+#define Z1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
+#define Z1_Done_Table( p ) \
+ do \
+ { \
+ if ( (p)->funcs.done ) \
+ (p)->funcs.done( p ); \
+ } while ( 0 )
+#define Z1_Release_Table( p ) \
+ do \
+ { \
+ if ( (p)->funcs.release ) \
+ (p)->funcs.release( p ); \
+ } while ( 0 )
+
+#define Z1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
+#define Z1_Skip_Alpha( p ) (p)->root.funcs.skip_alpha ( &(p)->root )
-#define Z1_Skip_Spaces(p) (p)->root.funcs.skip_spaces( &(p)->root )
-#define Z1_Skip_Alpha(p) (p)->root.funcs.skip_alpha ( &(p)->root )
+#define Z1_ToInt( p ) (p)->root.funcs.to_int( &(p)->root )
+#define Z1_ToFixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
-#define Z1_ToInt(p) (p)->root.funcs.to_int( &(p)->root )
-#define Z1_ToFixed(p,t) (p)->root.funcs.to_fixed( &(p)->root, t )
+#define Z1_ToCoordArray( p, m, c ) \
+ (p)->root.funcs.to_coord_array( &(p)->root, m, c )
+#define Z1_ToFixedArray( p, m, f, t ) \
+ (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
+#define Z1_ToToken( p, t ) \
+ (p)->root.funcs.to_token( &(p)->root, t )
+#define Z1_ToTokenArray( p, t, m, c ) \
+ (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
-#define Z1_ToCoordArray(p,m,c) (p)->root.funcs.to_coord_array( &(p)->root, m, c )
-#define Z1_ToFixedArray(p,m,f,t) (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
-#define Z1_ToToken(p,t) (p)->root.funcs.to_token( &(p)->root, t )
-#define Z1_ToTokenArray(p,t,m,c) (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
+#define Z1_Load_Field( p, f, o, m, pf ) \
+ (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
+#define Z1_Load_Field_Table( p, f, o, m, pf ) \
+ (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
-#define Z1_Load_Field(p,f,o,m,pf) (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
-#define Z1_Load_Field_Table(p,f,o,m,pf) (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
LOCAL_DEF
FT_Error Z1_New_Parser( Z1_Parser* parser,
@@ -118,10 +128,12 @@
LOCAL_DEF
void Z1_Done_Parser( Z1_Parser* parser );
+
#ifdef __cplusplus
}
#endif
+
#endif /* Z1PARSE_H */