1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315
|
<HTML>
<HEAD>
<!-- Created with AOLpress/2.0 -->
<!-- AP: Created on: 6-Apr-2007 -->
<!-- AP: Last modified: 28-Apr-2010 -->
<TITLE>Writing python scripts to change fonts in FontForge</TITLE>
<LINK REL="icon" href="fftype16.png">
<LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<DIV id="in">
<H1 ALIGN=Center>
Writing python scripts to change fonts in FontForge
</H1>
<P>
I assume you have a working knowledge of <A href="http://www.python.org/doc/">Python</A>.
FontForge implements two Python modules -- one great huge one
called <CODE><A HREF="python.html#fontforge">fontforge</A></CODE> which provides
access to as much of FontForge's functionality as I've had time to write,
and one tiny one called
<CODE><A HREF="python.html#psMat">psMat</A></CODE> which provides quick access
to some useful transformations expressed as PostScript matrices.
<P>
In python terms fontforge <EM>embeds</EM> python. It is possible to build
fontforge so that it is also a <A HREF="#Extension">python <EM>extension</EM>
</A>(<CODE>configure --enable-pyextension</CODE>)
<P>
The fontforge module also defines several types
<UL>
<LI>
<A href="#Point">point</A>
<LI>
<A href="#Contour">contour</A>
<LI>
<A href="#Layer">layer</A>
<LI>
<A href="#GlyphPen">glyphPen</A>
<LI>
<A href="#Glyph">glyph</A>
<LI>
<A href="#selection">selection</A>
<LI>
<A HREF="#private">private</A>
<LI>
<A HREF="#math">math</A>
<LI>
<A href="#Font">font</A>
</UL>
<H2>Command line convenience</H2>
<P>For convenience, Python commands given as a <CODE>-c</CODE> argument on the command line have the following code prepended:
<BLOCKQUOTE>
<PRE>from sys import argv; from fontforge import *</PRE>
</BLOCKQUOTE>
<P>Hence, the trivial script to convert a font can be written:
<BLOCKQUOTE>
<PRE>fontforge -c 'open(argv[1]).generate(argv[2])'</PRE>
</BLOCKQUOTE>
<TABLE id="module" border=1>
<CAPTION>
<A NAME="psMat">psMat</A>
</CAPTION>
<TR>
<TH span=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>identity</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>returns an identity matrix as a 6 element tuple</TD>
</TR>
<TR>
<TD><CODE>compose</CODE></TD>
<TD><CODE>(mat1,mat2)</CODE></TD>
<TD>returns a matrix which is the composition of the two input transformations</TD>
</TR>
<TR>
<TD><CODE>inverse</CODE></TD>
<TD><CODE>(mat)</CODE></TD>
<TD>returns a matrix which is the inverse of the input transformation. (Note:
There will not always be an inverse)</TD>
</TR>
<TR>
<TD><CODE>rotate</CODE></TD>
<TD><CODE>(theta)</CODE></TD>
<TD>returns a matrix which will rotate by <CODE>theta</CODE>.
<CODE>Theta</CODE> is expressed in radians</TD>
</TR>
<TR>
<TD><CODE>scale</CODE></TD>
<TD><CODE>(x[,y])</CODE></TD>
<TD>returns a matrix which will scale by <CODE>x</CODE> in the horizontal
direction and <CODE>y</CODE> in the vertical. If <CODE>y</CODE> is omitted,
it will scale by the same amount (<CODE>x</CODE>) in both directions</TD>
</TR>
<TR>
<TD><CODE>skew</CODE></TD>
<TD><CODE>(theta)</CODE></TD>
<TD>returns a matrix which will skew by <CODE>theta</CODE> (to produce a
oblique font). <CODE>Theta</CODE> is expressed in radians</TD>
</TR>
<TR>
<TD><CODE>translate</CODE></TD>
<TD><CODE>(x,y)</CODE></TD>
<TD>returns a matrix which will translate by <CODE>x</CODE> in the horizontal
direction and <CODE>y</CODE> in the vertical</TD>
</TR>
<TR>
<TH colspan=3>Types</TH>
</TR>
<TR>
<TD colspan=3>None</TD>
</TR>
</TABLE>
<P>
<TABLE id="module" border=1>
<CAPTION>
<A NAME="fontforge">fontforge</A>
</CAPTION>
<TR>
<TH colspan=3>Global Variables</TH>
</TR>
<TR>
<TH>variable</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE><A NAME="module-hooks">hooks</A></CODE></TD>
<TD colspan=2>A dictionary which the user may fill to associate certain fontforge
events with a python function to be run when those events happen. The function
will be passed the font (or possibly glyph) for which the relevant event
occurred.
<TABLE BORDER CELLPADDING="2">
<CAPTION>
Hook names
</CAPTION>
<TR>
<TD>newFontHook</TD>
<TD>This function will be called when a new font has been created.</TD>
</TR>
<TR>
<TD>loadFontHook</TD>
<TD>This function will be called when a font is loaded from disk.<BR>
(if a font has an "initScriptString" entry in its persistent dictionary,
that script will be invoked before this function).</TD>
</TR>
</TABLE>
<P>
Other hooks are defined in a font's own
<A HREF="#font-temporary">temporary</A> and
<A HREF="#font-persistent">persistent</A> dictionaries.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>getPrefs</CODE></TD>
<TD><CODE>(pref-name)</CODE></TD>
<TD>returns the value of the named preference item</TD>
</TR>
<TR>
<TD><CODE>setPrefs</CODE></TD>
<TD><CODE>(pref-name,value)</CODE></TD>
<TD>sets the value of the named preference item</TD>
</TR>
<TR>
<TD><CODE><A NAME="ff-hasSpiro">hasSpiro</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a boolean, <CODE>True</CODE> if Raph Levien's spiro package is
available for use in FontForge.</TD>
</TR>
<TR>
<TD><CODE>savePrefs</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Saves the current preference settings</TD>
</TR>
<TR>
<TD><CODE>loadPrefs</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Loads the user's default preference settings. Not done automatically
in a script.</TD>
</TR>
<TR>
<TD><CODE>defaultOtherSubrs</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Sets the type1 PostScript OtherSubrs to the default value</TD>
</TR>
<TR>
<TD><CODE>readOtherSubrsFile</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Sets the type1 PostScript OtherSubrs to the stuff found in the file.</TD>
</TR>
<TR>
<TD><CODE>loadEncodingFile</CODE></TD>
<TD><CODE>(filename[,encname])</CODE></TD>
<TD>Loads an encoding file, returns the name of the encoding or None.
When loading encodings in Unicode consortium format, an encname has to
be specefied or the encoding will be ignored and None will be
reterned.</TD>
</TR>
<TR>
<TD><CODE>loadNamelist</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Loads a namelist</TD>
</TR>
<TR>
<TD><CODE>loadNamelistDir</CODE></TD>
<TD><CODE>(dirname)</CODE></TD>
<TD>Loads all namelist files in the directory</TD>
</TR>
<TR>
<TD><CODE>loadPlugin</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Loads a fontforge plugin</TD>
</TR>
<TR>
<TD><CODE>loadPluginDir</CODE></TD>
<TD><CODE>(dirname)</CODE></TD>
<TD>Loads all fontforge plugins in the directory</TD>
</TR>
<TR>
<TD><CODE>preloadCidmap</CODE></TD>
<TD><CODE>(filename,registry,order,supplement)</CODE></TD>
<TD>Loads a fontforge cidmap file (first three args are strings, last is
an integer)</TD>
</TR>
<TR>
<TD><CODE><A name="printSetup">printSetup</A></CODE></TD>
<TD><CODE>(type[,printer|cmd|file,<BR>
width,height])</CODE></TD>
<TD>Prepare to <A href="#f-print">print a font sample</A>. The first argument
may be one of:
<DL>
<DT>
lp
<DD>
Queues postscript output to the printer using <CODE>lp</CODE>. You may use
the optional second argument to specify the printer name.
<DT>
lpr
<DD>
Queues postscript output to the printer using <CODE>lpr</CODE>. You may use
the optional second argument to specify the printer name.
<DT>
ghostview
<DD>
Displays the output using ghostview (or gv). The second argument is ignored.
<DT>
command
<DD>
Use a custom shell command to print the output. The second argument should
contain the command and its arguments.
<DT>
ps-file
<DD>
Dump the postscript output to a file. The second argument specifies the filename.
<DT>
pdf-file
<DD>
Dump the output as pdf to a file. The second argument specifies the filename.
</DL>
<P>
The third and fourth arguments are optional and specify the page size (in
points) for the output. The third argument is the page width and the fourth
is the height.
<P>
These setting remain until changed</TD>
</TR>
<TR>
<TD><CODE>nameFromUnicode</CODE></TD>
<TD><CODE>(uni[,namelist])</CODE></TD>
<TD>Finds the glyph name associated with a given unicode codepoint. If a
namelist is specified the name will be taken from that.</TD>
</TR>
<TR>
<TD><CODE>UnicodeAnnotationFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns the Unicode Annotations for this value as described by www.unicode.org.
If there is no unicode annotation for this value, or no library available,
then return empty string "". It can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>UnicodeBlockCountFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Return the number of Unicode Blocks as described by www.unicode.org.
Currently, the blocks are {0..233}, spanning unicode values {uni0..uni10FFFF}.
If there is no value, or no library available, then return -1.
This can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>UnicodeBlockEndFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns the Unicode Block end value as described by www.unicode.org.
Currently, the blocks are {0..233}, spanning unicode values {uni0..uni10FFFF}.
If there is no value, or no library available, then return -1.
This can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>UnicodeBlockNameFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns the Unicode Block Name as described by www.unicode.org.
Currently, the blocks are {0..233}, spanning unicode values {uni0..uni10FFFF}.
If there is no value, or no library available, then return empty string "".
This can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>UnicodeBlockStartFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns the Unicode Block start value as described by www.unicode.org.
Currently, the blocks are {0..233}, spanning unicode values {uni0..uni10FFFF}.
If there is no value, or no library available, then return -1.
This can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>unicodeFromName</CODE></TD>
<TD><CODE>(glyphname)</CODE></TD>
<TD>Looks up glyph name in its dictionary and if it is associated with a
unicode code point returns that number. Otherwise it returns -1</TD>
</TR>
<TR>
<TD><CODE>UnicodeNameFromLib</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns the Unicode Name for this value as described by www.unicode.org.
If there is no unicode name for this value, or no library available,
then return empty string "". It can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>UnicodeNamesListVersion</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Return the Unicode Nameslist Version (as described by www.unicode.org).
libuninameslist is released on a schedule that depends on
when www.unicode.org releases new information. These dates do not match
FontForge release dates, therefore users might not keep this optional library
upto current updates. This instruction can be used to test if the Nameslist
library is recent for your script. This function currently works only for
libuninameslist ver_0.3.20130501 or later, else it returns empty string "".
This can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>IsFraction</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Return 1 if n is a unicode fraction (either a vulgar fraction or other
fraction) as described by www.unicode.org. Return 0 if there is no
fraction for this value. It can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>IsLigature</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Return 1 if n is a ligature as described by www.unicode.org. Return 0
if there is no unicode ligature for this value. It can execute with no
current font.</TD>
</TR>
<TR>
<TD><CODE>IsOtherFraction</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Return 1 if n is a unicode fraction (not defined as vulgar fraction)
as described by www.unicode.org. Return 0 if there is no fraction for
this value. It can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>IsVulgarFraction</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Return 1 if n is a unicode vulgar fraction as described by
www.unicode.org. Return 0 if there is no fraction for this value.
It can execute with no current font.</TD>
</TR>
<TR>
<TD><CODE>ucFracChartGetCnt</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns total count of Fractions found in the Unicode chart as
described by www.unicode.org. It can execute with no current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucLigChartGetCnt</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns total count of Ligatures found in the Unicode chart as
described by www.unicode.org. It can execute with no current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucLigChartGetLoc</CODE></TD>
<TD><CODE>(val)</CODE></TD>
<TD>Returns n for FontForge internal table Unicode val=Ligature[n]. If
val does not exist in table, then return -1. Can execute with no
current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucLigChartGetNxt</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns FontForge internal table Unicode Ligature[n]. Return -1 if
n<0 or n>=ucLigChartGetCnt(). It can execute with no current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucOFracChartGetCnt</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns total count of non-Vulgar Fractions found in the Unicode
chart as described by www.unicode.org. It can execute with no current
font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucOFracChartGetLoc</CODE></TD>
<TD><CODE>(val)</CODE></TD>
<TD>Returns n for FontForge internal table Unicode val=OtherFraction[n].
If val does not exist in table, then return -1. Can execute with no
current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucOFracChartGetNxt</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns FontForge internal table Unicode (non-vulgar) Fraction[n].
Return -1 if n<0 or n>=ucOFracChartGetCnt(). Can execute with no
current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucVulChartGetCnt</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns total count of Vulgar Fractions found in the Unicode chart
as described by www.unicode.org. It can execute with no current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucVulChartGetLoc</CODE></TD>
<TD><CODE>(val)</CODE></TD>
<TD>Returns n for FontForge internal table Unicode val=VulgarFraction[n].
If val does not exist in table, then return -1. Can execute with no
current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>ucVulChartGetNxt</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns FontForge internal table Unicode Vulgar Fraction[n]. Returns
-1 if n<0 or n>=ucVulChartGetCnt(). Can execute with no current font.
<BR>Note: Count depends on chart version built into FontForge.</TD>
</TR>
<TR>
<TD><CODE>SpiroVersion</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns the version of LibSpiro available to FontForge.<BR>
Versions 0.1 to 0.5 do not have a method to indicate version numbers,
but there is a limited method to estimate versions {'0.0'..'0.5'}.
<P>
'0.0' if FontForge has no LibSpiro available.<BR>
'0.1' if LibSpiro 20071029 is available.<BR>
'0.2' if LibSpiro 0.2 to 0.5 is available.<BR>
LibSpiro 0.6 and higher reports back it's version available.</TD>
</TR>
<TR>
<TD><CODE>version</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns fontforge's version number. This will be a large number like
20070406.</TD>
</TR>
<TR>
<TD><CODE>runInitScripts</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Runs the system or user initialization scripts, if not already run. This is primarily intended when importing FontForge into a python process.</TD>
</TR>
<TR>
<TD><CODE>scriptPath</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a tuple listing the directory paths which are searched for python scripts during FontForge initialization.</TD>
</TR>
<TR>
<TD><CODE>fonts</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a tuple of all fonts currently loaded into fontforge for editing</TD>
</TR>
<TR>
<TD><CODE>activeFont</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>If the script were invoked from the File->Execute Script... dialog,
or invoked by a menu item in the font view, this returns the font that was
active at the time. Otherwise it returns None.</TD>
</TR>
<TR>
<TD><CODE>activeGlyph</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>If the script were invoked from the File->Execute Script... dialog
or a menu item from an outline glyph window or a glyph import/export command
this returns the glyph that was active at the time. Otherwise it returns
None.</TD>
</TR>
<TR>
<TD><CODE>activeLayer</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>This returns the currently active layer as an integer between 0 (inclusive)
and the font/glyph's layer count (exclusive). It may also be set to -1 if
the current glyph window is displaying the font's guidline layer.</TD>
</TR>
<TR>
<TD><CODE>fontsInFile</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Returns a tuple of all fontnames found in the specified file. The tuple
may be empty if fontforge couldn't find any.</TD>
</TR>
<TR>
<TD><CODE>open</CODE></TD>
<TD><CODE>(filename[,flags])</CODE></TD>
<TD>Opens a filename and returns the font it contains. If it does.
<P>
If the flags argument is 4, then ff will load all glyphs in the 'glyf' table
of a ttc file (rather than just the glyphs used in the font picked). This
will not load all 'glyf' tables though.</TD>
</TR>
<TR>
<TD><CODE>parseTTInstrs</CODE></TD>
<TD><CODE>(string)</CODE></TD>
<TD>Returns a binary string each byte of which corresponds to a truetype
instruction. The input string should contain a set of instruction names as
"SRP0\nMIRP[min,rnd,black]"</TD>
</TR>
<TR>
<TD><CODE>unParseTTInstrs</CODE></TD>
<TD><CODE>(sequence)</CODE></TD>
<TD>Reverse of the above. Converts a binary string into a human (sort of)
readable string</TD>
</TR>
<TR>
<TD><CODE>unitShape</CODE></TD>
<TD><CODE>(n)</CODE></TD>
<TD>Returns a closed contour which is a regular n-gon. The contour will be
inscribed in the unit circle. If n is negative, then the contour will be
circumscribed around the unit circle. A value of 0 will produce a unit circle.
If n==1 it is treated as if n were -4 -- a circumscribed square where each
side is 2 units long (this is for historical reasons). Behavior is undefined
for n=2,-1,-2.</TD>
</TR>
<TR>
<TD><CODE>registerGlyphSeparationHook</CODE></TD>
<TD><CODE>(hook)</CODE></TD>
<TD>The GlpyphSeparationHook is a python routine which FontForge will call
when it wants to figure out the optical separation between two glyphs. If
you neve call this, or if you call it with a value of <CODE>None</CODE> FontForge
will use a built-in default. This routine gets called during AutoWidth, AutoKern,
and computing the optical left and right side bearings (for 'lfbd' and 'rtbd'
features). For more infomation see
<A HREF="autowidth.html#GlyphSeparationHook">its own section</A>.</TD>
</TR>
<TR>
<TH colspan=3>User Interface Methods</TH>
</TR>
<TR>
<TD colspan=3><A NAME="python-init-scripts">Users</A> may define scripts
to be run when menu items are invoked. Some of these scripts will want to
ask users questions, so this section provides routines to determine if fontforge
has a user interface, a command to add menu items, and various small standard
dialogs to interact with the user. I do not currently provide a mechanism
for allowing people to define special purpose dialogs (for example they might
want to ask more than one question in a dialog, and I don't support that).
<P>
When FontForge <A NAME="starts">starts</A> (if it's a fontforge with python)
it will look at the directories <CODE>$(PREFIX)/share/fontforge/python</CODE>
and <CODE>~/.FontForge/python</CODE> and attempt to run all files in those
directories which end in ".py". Presumably these files will allow people
to customize the user interface to suit their needs.
<P>
Currently it reads the files in directory order (which is generally somewhere
between creation order and totally random). It will read the system directory
before the user directory.
<H3>
Example
</H3>
<BLOCKQUOTE>
<PRE>import fontforge
def nameGlyph(junk,glyph):
print glyph.glyphname
fontforge.registerMenuItem(nameGlyph,None,None,"Glyph",None,"Print Glyph Name")
def neverEnableMe(junk,glyph):
return False
fontforge.registerMenuItem(nameGlyph,neverEnableMe,None,"Glyph",None,"SubMenu","Print Glyph Name")
def importGlyph(junk,glyph,filename,toback):
print "Import"
print glyph.glyphname
print filename
def exportGlyph(junk,glyph,filename):
print "Import"
print glyph.glyphname
print filename
fontforge.registerImportExport(importGlyph,exportGlyph,None,"foosball","foo","foo,foobar")
</PRE>
</BLOCKQUOTE>
<P>
The first call will define a menu item in the Tools menu of the Glyph window.
The menu will be called "Print Glyph Name". It has no shortcut to invoke
it. It needs no external data. It is always enabled. And when activated it
will invoke the function "nameGlyph" whch prints the name of the glyph in
the window from which the command is invoked.
<P>
The second call defines a menu item in a submenu of the Tools menu. This
submenu is called "SubMenu". This item will never be enabled -- but if it
were enabled it would again call "nameGlyph" to print the name of the current
glyph.
<P>
The last provides a way to import and export files of type "foosball" (or
it would if the routines did anything).
<P>
Not a very useful example</TD>
</TR>
<TR>
<TD><CODE>hasUserInterface</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns True if this session of FontForge has a user interface</TD>
</TR>
<TR>
<TD><CODE>registerMenuItem</CODE></TD>
<TD><CODE>(menu-function,<BR>
enable_function,<BR>
data,<BR>
which_window,<BR>
shortcut_string,<BR>
{submenu-names,}<BR>
menu-name-string)</CODE></TD>
<TD>If fontforge has a user interface this will add this menu item to FontForge's
<A HREF="toolsmenu.html#Tools">Tool</A> menu, either in the font or the outline
glyph view (or both).
<DL>
<DT>
menu-function
<DD>
This is the function that will be called when the menu item is activated.
It will be passed two arguments, the first is the data value specified here
(which may be None, indeed will probably usually be None), and the second
is the glyph or font (depending on the window type) from which the menu item
was activated. Its return value is ignored.
<DT>
enable_function
<DD>
This may be None -- in which case the menu item will always be enabled. Otherwise
it will be called before the menu pops up on the screen to determine whether
this item should be enabled. It will be passed the same arguments as above.
It should return True if the item should be enabled and False otherwise.
<DT>
data
<DD>
This can be whatever you want (including None). FontForge keeps track of
it and passes it to both of the above functions. Use it if you need to provide
some context for the menu item.
<DT>
which_window
<DD>
May be either of the strings "Font" or "Glyph (or the tuple
<CODE>("Font","Glyph")</CODE>) and it determines which type of window will
have this menu item in its "Tools" menu.
<DT>
shortcut-string
<DD>
May be None if you do not wish to supply a shortcut. Otherwise should be
a string like "Menu Name|Cntl-H" (the syntax is defined in the
<A HREF="uitranslationnotes.html#HotKeys">translation section</A>).
<DT>
submenu-names
<DD>
You may specify as many of these as you wish (including leaving them out
altogether), this allows you to organize the Tools menu into submenus. (If
a submenu of this name does not currently exist, fontforge will create it).
<DT>
menu-name
<DD>
The name that will appear in the menu for this item.
</DL>
<P>
This will only affect windows created after this command is executed. Normally
the command will be executed at startup and so it will affect all windows.</TD>
</TR>
<TR>
<TD><CODE>registerImportExport</CODE></TD>
<TD><CODE>(import-function,<BR>
export_function,<BR>
data,<BR>
name,<BR>
extension,<BR>
[extension-list])</CODE></TD>
<TD>This will add the capability to import or export files of a given type,
presumably a way of specifying the splines in a given glyph.
<DL>
<DT>
import-function
<DD>
The function to call to import a file into a glyph. It will be called with:
The data argument (specified below), A pointer to the glyph into which the
import is to happen, A filename, A flag indicating whether the import should
go to the background layer or foreground.
<P>
This function may be None. In which case there is no import method for this
file type.
<DT>
export-function
<DD>
The function to call to export a glyph into a file. It will be called with:
The data argument (see below), a pointer to the glyph, and a filename.
<P>
This function may be None, in which case there is no export method for this
file type.
<DT>
data
<DD>
Anything you like (including None). It will be passed to the import/export
routines and can provide them with context if they need that.
<DT>
name
<DD>
The name to be displayed in the user interface for this file type. This may
just be the extension, or it might be something more informative.
<DT>
extension
<DD>
This is the default extension for this file type. It is used by the export
dialog to pick an extension for the generated filename.
<DT>
extension-list
<DD>
Some file types have more than one common extension (eps files are usually
named "eps", but I have also seen "ps" and "art" used). The import dialog
needs to filter all possible filenames of this file type. This argument should
be a comma separated list of extensions. It may be omitted, in which case
it defaults to being the same as the "extension" argument above.
</DL>
</TD>
</TR>
<TR>
<TD><CODE>logWarning</CODE></TD>
<TD><CODE>(msg)</CODE></TD>
<TD>Adds the message (a string) to FontForge's Warnings window. (if you wish
to display a % character you must represent it as two percents). If there
is no user interface the output will go to stderr.</TD>
</TR>
<TR>
<TD><CODE>postError</CODE></TD>
<TD><CODE>(win-title,msg)</CODE></TD>
<TD>Creates a popup dialog to display the message (a string) in that dlg.
(if you wish to display a % character you must represent it as two percents).
If there is no user interface the output will go to stderr.</TD>
</TR>
<TR>
<TD><CODE>postNotice</CODE></TD>
<TD><CODE>(win-title,msg)</CODE></TD>
<TD>Creates a little window which will silently vanish after a minute or
two and displays the message (a string) in that window. (if you wish to display
a % character you must represent it as two percents). If there is no user
interface the output will go to stderr.</TD>
</TR>
<TR>
<TD><CODE>openFilename</CODE></TD>
<TD><CODE>(question,[def-name,[filter]])</CODE></TD>
<TD>All arguments are strings. The first is a question asked to the user
(for which a filename to open is presumed to be the answer). The second is
optional and provides a default filename. The third is optional and provides
a filter (like "*.sfd")
<P>
The result is either a filename or None if the user canceled the dialog.
<P>
Throws an exception if there is no user interface.</TD>
</TR>
<TR>
<TD><CODE>saveFilename</CODE></TD>
<TD><CODE>(question,[def-name,[filter]])</CODE></TD>
<TD>All arguments are strings. The first is a question asked to the user
(for which a filename to save something to is presumed to be the answer).
The second is optional and provides a default filename. The third is optional
and provides a filter (like "*.sfd")
<P>
The result is either a filename or None if the user canceled the dialog.
<P>
Throws an exception if there is no user interface.</TD>
</TR>
<TR>
<TD><CODE>ask</CODE></TD>
<TD><CODE>(title,question,answers,<BR>
[def,cancel])</CODE></TD>
<TD>Allows you to ask the user a multiple choice question. It popups up a
dialog posing the question with a list of buttons ranged underneath it --
one for each answer.
<P>
The first argument is the dialog's title, the second is the question to be
asked, the third is a tuple of strings -- each string will become a button,
the fourth and fifth arguments are option, the fourth is the index in the
answer array that will be the default answer (the one invoked if the user
presses the [Return] key), and the fifth is the answer invoked if the user
presses the [Escape] key. If omitted the default answer will be the first,
and the cancel answer will be the last.
<P>
The function returns the index in the answer array of the answer choosen
by the user.
<P>
Throws an exception if there is no user interface.</TD>
</TR>
<TR>
<TD><CODE>askChoice</CODE>s</TD>
<TD><CODE>(title,question,answers,<BR>
[def])</CODE></TD>
<TD>Similar to the above allows you to ask the user a multiple choice question.
It popups up a dialog posing the question with a scrollable list of choices
-- one for each answer.
<P>
The first argument is the dialog's title, the second is the question to be
asked, the third is a tuple of strings -- each string will become a button,
the fourth and fifth arguments are option, the fourth is the index in the
answer array that will be the default answer (the one invoked if the user
presses the [Return] key). If omitted the default answer will be the first.
<P>
The function returns the index in the answer array of the answer choosen
by the user. If the user cancels the dialog, a -1 is returned.
<P>
Throws an exception if there is no user interface.</TD>
</TR>
<TR>
<TD><CODE>askString</CODE></TD>
<TD><CODE>(title,question,[def-string])</CODE></TD>
<TD>Allows you to as the user a question for which a string is the answer.
<P>
The first argument is the dialog's title, the second is the question to be
asked, the third is optional and specified a default answer.
<P>
The function returns the string the user typed or None if they cancelled
the dialog.
<P>
Throws an exception if there is no user interface.</TD>
</TR>
<TR>
<TH colspan=3>Types</TH>
</TR>
<TR>
<TD colspan=3><A href="#Point">point</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#Contour">contour</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#Layer">layer</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#GlyphPen">glyphPen</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#Glyph">glyph</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#selection">selection</A></TD>
</TR>
<TR>
<TD colspan=3><A href="#Font">font</A></TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="Point">point</A>
</CAPTION>
<TR>
<TH colspan=3>Creation</TH>
</TR>
<TR>
<TD><CODE>fontforge.point</CODE></TD>
<TD><CODE>([x,y,on-curve])</CODE></TD>
<TD>Creates a new point. Optionally specifying its location</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>x</CODE></TD>
<TD colspan=2>The x location of the point</TD>
</TR>
<TR>
<TD><CODE>y</CODE></TD>
<TD colspan=2>The y location of the point</TD>
</TR>
<TR>
<TD><CODE>on_curve</CODE></TD>
<TD colspan=2>Whether this is an on curve point or an off curve point (a
control point)</TD>
</TR>
<TR>
<TD><CODE>selected</CODE></TD>
<TD colspan=2>Whether this point is selected in the UI. If an off-curve point
is selected in means the preceding (interpolated) on-curve point is selected.</TD>
</TR>
<TR>
<TD><CODE>name</CODE></TD>
<TD colspan=2>The point name (generally there is no name)</TD>
</TR>
<TR>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>dup</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a copy of the current point.</TD>
</TR>
<TR>
<TD><CODE>transform</CODE></TD>
<TD><CODE>(tuple)</CODE></TD>
<TD>Transforms the point by the transformation matrix</TD>
</TR>
<TR>
<TH colspan=3>Pickling Methods</TH>
</TR>
<TR>
<TD><CODE>__reduce__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>This function allows the pickler to work on this type. I don't think
it is useful for anything else.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="Contour">contour</A>
</CAPTION>
<TR>
<TH colspan=3>Description</TH>
</TR>
<TR>
<TD colspan=3>A contour is a collection of points. A contour may be either
based on cubic or quadratic splines.
<P>
If based on cubic splines there should be either 0 or 2 off-curve points
between every two on-curve points. If there are no off-curve points then
we have a line between those two points. If there are 2 off-curve points
we have a cubic bezier curve between the two end points.
<P>
If based on quadratic splines things are more complex. Again, two adjacent
on-curve points yield a line between those points. Two on-curve points with
an off-curve point between them yields a quadratic bezier curve. However
if there are two adjacent off-curve points then an on-curve point will be
interpolated between them. (This should be familiar to anyone who has read
the truetype 'glyf' table docs).
<P>
For examples of what these splines can look like see the
<A HREF="bezier.html">section on bezier curves</A>.
<P>
A contour may be open in which case it is just a long wiggly line, or closed
when it is more like a circle with an inside and an outside. Unless you are
making stroked fonts all your contours should eventually be closed.
<P>
Contours may also be expressed in terms of Raph Levien's spiro points. This
is an alternate representation for the contour, and is not always available
(Only if <CODE><A HREF="python.html#ff-hasSpiro">fontforge.hasSpiro</A>()
</CODE>is<CODE> True</CODE>. If available the spiro member will return a
tuple of spiro control points, while assigning to this member will change
the shape of the contour to match the new spiros.
<P>
Two contours may be compared to see if they describe similar paths.</TD>
</TR>
<TR>
<TH colspan=3>Creation</TH>
</TR>
<TR>
<TD><CODE>fontforge.contour</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Creates a new contour</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>is_quadratic</CODE></TD>
<TD colspan=2>Whether the contour should be interpretted as a set of quadratic
or cubic splines. Setting this value has the side effect of converting the
point list to the appropriate format</TD>
</TR>
<TR>
<TD><CODE>closed</CODE></TD>
<TD colspan=2>Whether the contour is open or closed</TD>
</TR>
<TR>
<TD><CODE>name</CODE></TD>
<TD colspan=2>The contour name (generally there is no name)</TD>
</TR>
<TR>
<TD><CODE>spiros</CODE></TD>
<TD colspan=2>This is an alternate representation of a curve. This member
is only available if <A HREF="#ff-hasSpiro">fontforge.hasSpiro()</A> is True.
Returns a tuple of spiro control points. Each of these is itself a tuple
of four elements, an x,y location, a type field, and a set of flags. The
type field takes on values (which are predefined constants in the fontforge
module):
<TABLE>
<TR>
<TD>fontforge.spiroG4</TD>
<TD>1</TD>
<TD>A Spiro G4 curve point</TD>
</TR>
<TR>
<TD>fontforge.spiroG2</TD>
<TD>2</TD>
<TD>A Spiro G2 curve point</TD>
</TR>
<TR>
<TD>fontforge.spiroCorner</TD>
<TD>3</TD>
<TD>A Spiro corner point</TD>
</TR>
<TR>
<TD>fontforge.spiroLeft</TD>
<TD>4</TD>
<TD>A Spiro left "tangent" point</TD>
</TR>
<TR>
<TD>fontforge.spiroRight</TD>
<TD>5</TD>
<TD>A Spiro right "tangent" point</TD>
</TR>
<TR>
<TD>fontforge.spiroOpen</TD>
<TD>6</TD>
<TD>This may only be used on the first point in a spiro tuple. It indicates
that the tuple describes an open contour.</TD>
</TR>
</TABLE>
<P>
For more information on what these point types mean see
<A HREF="http://www.levien.com/spiro/">Raph Levien's work</A>.
<P>
The flags argument is treated as a bitmap of which currently on one bit (0x1)
is defined. This indicates that this point is selected in the UI.
<P>
When you assign a tuple of spiro control points to this member, the point
list for the Bezier interpretation of the contour will change. And when you
change the Bezier interpretation the set of spiro points will change.</TD>
</TR>
<TR>
<TH colspan=3>Sequence Protocol</TH>
</TR>
<TR>
<TD colspan=2><CODE>len(c)</CODE></TD>
<TD>The number of points in the contour</TD>
</TR>
<TR>
<TD colspan=2><CODE>c[i]</CODE></TD>
<TD>The <EM>i</EM>th point on the contour. You may assign to this</TD>
</TR>
<TR>
<TD colspan=2><CODE>c[i:j]</CODE></TD>
<TD>The contour containing points between i and j. You may assign to this</TD>
</TR>
<TR>
<TD colspan=2><CODE>c + d</CODE></TD>
<TD>A contour concatenating c and d. D may be either another contour or a
point.</TD>
</TR>
<TR>
<TD colspan=2><CODE>c += d</CODE></TD>
<TD>Appends d to c. D may be either another contour or a point.</TD>
</TR>
<TR>
<TD colspan=2><CODE>p in c</CODE></TD>
<TD>Returns whether the point p is in the contour c. p may be either a point
or a tuple of two numbers</TD>
</TR>
<TR>
<TD colspan=3>Does not support the repeat concept</TD>
</TR>
<TR>
<TH colspan=3>Iterator Protocol</TH>
</TR>
<TR>
<TD><CODE>__iter__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns an iterator for the contour which will return the points in order.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>dup</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a deep copy of the contour. That is, it copies the points that
make up the contour.</TD>
</TR>
<TR>
<TD><CODE>isEmpty</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether the contour is empty (contains no points)</TD>
</TR>
<TR>
<TD> </TD>
<TH colspan=2>Contour construction</TH>
</TR>
<TR>
<TD><CODE>moveTo</CODE></TD>
<TD><CODE>(x,y)</CODE></TD>
<TD>Adds an initial, on-curve point at (x,y) to the contour</TD>
</TR>
<TR>
<TD><CODE>lineTo</CODE></TD>
<TD><CODE>(x,y[,pos])</CODE></TD>
<TD>Adds an line to the contour. If the optional third argument is give,
the line will be added after the pos'th point, otherwise it will be at the
end of the contour.</TD>
</TR>
<TR>
<TD><CODE>cubicTo</CODE></TD>
<TD><CODE>((cp1x,cp1y)(cp2x,cp2y)(x,y)[,pos])</CODE></TD>
<TD>Adds a cubic curve to the contour. If the optional third argument is
give, the line will be added after the pos'th point, otherwise it will be
at the end of the contour.</TD>
</TR>
<TR>
<TD><CODE>quadraticTo</CODE></TD>
<TD><CODE>((cpx,cpy)(x,y)[,pos])</CODE></TD>
<TD>Adds a quadratic curve to the contour. If the optional third argument
is give, the line will be added after the pos'th point, otherwise it will
be at the end of the contour.</TD>
</TR>
<TR>
<TD><CODE>insertPoint</CODE></TD>
<TD><CODE>(point[,pos])</CODE></TD>
<TD>Adds point to the contour. If the optional third argument is give, the
line will be added after the pos'th point, otherwise it will be at the end
of the contour. The point may be either a point or a tuple with three members
(x,y,on_curve)</TD>
</TR>
<TR>
<TD><CODE>makeFirst</CODE></TD>
<TD><CODE>(pos)</CODE></TD>
<TD>Rotate the point list so that the pos'th point becomes the first point</TD>
</TR>
<TR>
<TD><CODE><A name="#cnt-isClockwise">isClockwise</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether the contour is drawn in a clockwise direction. A return
value of -1 indicates that no consistant direction could be found (the contour
self-intersects).</TD>
</TR>
<TR>
<TD><CODE>reverseDirection</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Reverse the order in which the contour is drawn (turns a clockwise contour
into a counter-clockwise one). See also
<A href="#l-correctDirection">layer.correctDirection</A>.</TD>
</TR>
<TR>
<TD><CODE>similar</CODE></TD>
<TD><CODE>(other-contour[,error])</CODE></TD>
<TD>Checks whether this contour is similar to the other one where error is
the maximum distance (in em-units) allowed for the two contours to diverge.
<P>
This is like the comparison operator, but that doesn't allow you to specify
an error bound.</TD>
</TR>
<TR>
<TD><CODE>xBoundsAtY</CODE></TD>
<TD><CODE>(ybottom[,ytop])</CODE></TD>
<TD>Finds the minimum and maximum x positions attained by the contour when
y is between ybottom and ytop (if ytop is not specified it is assumed the
same as ybottom). If the contour does not have any y values in the specified
range then ff will return None.</TD>
</TR>
<TR>
<TD><CODE>yBoundsAtX</CODE></TD>
<TD><CODE>(xleft[,xright])</CODE></TD>
<TD>Finds the minimum and maximum y positions attained by the contour when
x is between xleft and xright (if xright is not specified it is assumed the
same as xleft). If the contour does not have any x values in the specified
range then ff will return None.</TD>
</TR>
<TR>
<TD> </TD>
<TH colspan=2>Contour manipulation</TH>
</TR>
<TR>
<TD><CODE>addExtrema</CODE></TD>
<TD><CODE>([flags,emsize])</CODE></TD>
<TD>Extrema should be marked by on-curve points. If a curve lacks a point
at an extrema this command will add one. Flags may be one of the following
strings
<DL>
<DT>
all
<DD>
Add all missing extrema
<DT>
only_good
<DD>
Only add extrema on longer splines (with respect to the em-size)
<DT>
only_good_rm
<DD>
As above but also merge away on-curve points which are very close to, but
not on, an added extremum
</DL>
</TD>
</TR>
<TR>
<TD><CODE><A name="cnt-cluster">cluster</A></CODE></TD>
<TD><CODE>([within,max])</CODE></TD>
<TD>Moves clustered coordinates to a standard central value. See Also
<A href="#cnt-round">round</A></TD>
</TR>
<TR>
<TD><CODE><A name="cnt-merge">merge</A></CODE></TD>
<TD><CODE>(pos)</CODE></TD>
<TD>Removes the on-curve point a the given position and rearranges the other
points to make the curve as similar to the original as possible. (pos may
also be a tuple of positions, all of which will be removed) See Also
<A href="#cnt-simplify">simplify</A></TD>
</TR>
<TR>
<TD><CODE><A name="cnt-round">round</A></CODE></TD>
<TD><CODE>([factor])</CODE></TD>
<TD>Rounds the x and y coordinates. If factor is specified then new-coord
= round(factor*old-coord)/factor. See Also <A href="#cnt-cluster">cluster</A></TD>
</TR>
<TR>
<TD><CODE>selfIntersects</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether this contour intersects itself.</TD>
</TR>
<TR>
<TD><CODE><A name="cnt-simplify">simplify</A></CODE></TD>
<TD><CODE>([error-bound,flags,tan_bounds,<BR>
linefixup,linelenmax])</CODE></TD>
<TD>Tries to remove excess points on the contour if doing so will not perturb
the curve by more than <CODE>error-bound</CODE>. Flags is a tuple of the
following strings
<DL>
<DT>
ignoreslopes
<DD>
Allow slopes to change
<DT>
ignoreextrema
<DD>
Allow removal of extrema
<DT>
smoothcurves
<DD>
Allow curve smoothing
<DT>
choosehv
<DD>
Snap to horizontal or vertical
<DT>
forcelines
<DD>
flatten bumps on lines
<DT>
nearlyhvlines
<DD>
Make nearly horizontal/vertical lines be so
<DT>
mergelines
<DD>
Merge adjacent lines into one
<DT>
setstarttoextremum
<DD>
Rotate the point list so that the start point is on an extremum
<DT>
removesingletonpoints
<DD>
If the contour contains just one point then remove it
</DL>
<P>
See Also <A href="#cnt-merge">merge</A></TD>
</TR>
<TR>
<TD><CODE>transform</CODE></TD>
<TD><CODE>(matrix)</CODE></TD>
<TD>Transforms the contour by the matrix</TD>
</TR>
<TR>
<TD></TD>
<TH colspan=2>random stuff about contours</TH>
</TR>
<TR>
<TD><CODE>boundingBox</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a tuple representing a rectangle (xmin,ymin, xmax,ymax) into
which the contour fits. It is not guaranteed to be the smallest such rectangle,
but it will often be.</TD>
</TR>
<TR>
<TD><CODE>getSplineAfterPoint</CODE></TD>
<TD><CODE>(pos)</CODE></TD>
<TD>Returns a tuple of two four-element tuples. These tuples are x and y
splines for the curve after the specified point.</TD>
</TR>
<TR>
<TD><CODE>draw</CODE></TD>
<TD><CODE>(pen)</CODE></TD>
<TD>Draw the contour to the
<A href="http://www.robofab.org/objects/pen.html">pen argument.</A></TD>
</TR>
<TR>
<TH colspan=3>Pickling Methods</TH>
</TR>
<TR>
<TD><CODE>__reduce__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>This function allows the pickler to work on this type. I don't think
it is useful for anything else.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="Layer">layer</A>
</CAPTION>
<TR>
<TH colspan=3>Description</TH>
</TR>
<TR>
<TD colspan=3>A layer is a collection of contours. All the contours must
be the same order (all quadratic or all cubic). Currently layers do not contain
references.
<P>
Layers may be compared to see if their contours are similar.</TD>
</TR>
<TR>
<TH colspan=3>Creation</TH>
</TR>
<TR>
<TD><CODE>fontforge.layer</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Creates a new layer</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>is_quadratic</CODE></TD>
<TD colspan=2>Whether the contours should be interpretted as a set of quadratic
or cubic splines. Setting this value has the side effect of converting the
contour list to the appropriate format</TD>
</TR>
<TR>
<TH colspan=3>Sequence Protocol</TH>
</TR>
<TR>
<TD colspan=2><CODE>len(c)</CODE></TD>
<TD>The number of contours in the layer</TD>
</TR>
<TR>
<TD colspan=2><CODE>c[i]</CODE></TD>
<TD>The <EM>i</EM>th contour on the layer. You may assign to this</TD>
</TR>
<TR>
<TD colspan=2><CODE>c + d</CODE></TD>
<TD>A layer concatenating c and d. D may be either another layer or a contour.</TD>
</TR>
<TR>
<TD colspan=2><CODE>c += d</CODE></TD>
<TD>Appends d to c. D may be either another layer or a contour.</TD>
</TR>
<TR>
<TD colspan=3>Does not support the repeat, slice and contains concepts</TD>
</TR>
<TR>
<TH colspan=3>Iterator Protocol</TH>
</TR>
<TR>
<TD><CODE>__iter__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns an iterator for the layer which will return the contours in order.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>dup</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a deep copy of the layer. That is, it will copy all the contours
and all the points as well as copying the layer object itself.</TD>
</TR>
<TR>
<TD><CODE>isEmpty</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether the layer is empty (contains no contour)</TD>
</TR>
<TR>
<TD><CODE>addExtrema</CODE></TD>
<TD><CODE>([flags,emsize])</CODE></TD>
<TD>Extrema should be marked by on-curve points. If a curve lacks a point
at an extrema this command will add one. Flags may be one of the following
strings
<DL>
<DT>
all
<DD>
Add all missing extrema
<DT>
only_good
<DD>
Only add extrema on longer splines (with respect to the em-size)
<DT>
only_good_rm
<DD>
As above but also merge away on-curve points which are very close to, but
not on, an added extremum
</DL>
</TD>
</TR>
<TR>
<TD><CODE><A name="l-cluster">cluster</A></CODE></TD>
<TD><CODE>([within,max])</CODE></TD>
<TD>Moves clustered coordinates to a standard central value. See also
<A href="#l-round">round</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="l-correctDirection">correctDirection</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Orients all contours so that external ones are clockwise and internal
counter-clockwise. See also
<A href="#cnt-isClockwise">contour.isClockwise</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="l-export">export</A></CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Exports the current layer (in outline format) to a file. The type of
file is determined by the extension.</TD>
</TR>
<TR>
<TD><CODE><A name="l-exclude">exclude</A></CODE></TD>
<TD><CODE>(excluded-layer)</CODE></TD>
<TD>Removes the excluded area from the current contours. See also
<A href="#l-removeOverlap">removeOverlap</A> and
<A href="#l-intersect">intersect</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="l-intersect">intersect</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Leaves only areas in the intersection of contours. See also
<A href="#l-removeOverlap">removeOverlap</A> and
<A href="#l-exclude">exclude</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="l-removeOverlap">removeOverlap</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes overlapping areas. See also <A href="#l-intersect">intersect</A>
and <A href="#l-exclude">exclude</A>.</TD>
</TR>
<TR>
<TD><CODE>interpolateNewLayer</CODE></TD>
<TD><CODE>(other-layer,amount)</CODE></TD>
<TD>Creates (and returns) a new layer which contains splines interpolated
from the current layer and the first argument. If amount is 0 the result
will look like the current layer, if 1 then like the first argument.</TD>
</TR>
<TR>
<TD><CODE><A name="l-round">round</A></CODE></TD>
<TD><CODE>([factor])</CODE></TD>
<TD>Rounds the x and y coordinates. If factor is specified then new-coord
= round(factor*old-coord)/factor. See also <A href="#l-cluster">cluster</A>.</TD>
</TR>
<TR>
<TD><CODE>selfIntersects</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether any of the contours on this layer intersects any other
contour (including itself).</TD>
</TR>
<TR>
<TD><CODE>similar</CODE></TD>
<TD><CODE>(other-layer[,error])</CODE></TD>
<TD>Checks whether this layer is similar to the other one where error is
the maximum distance (in em-units) allowed for any two corresponding contours
in the layers to diverge.
<P>
This is like the comparison operator, but that doesn't allow you to specify
an error bound.</TD>
</TR>
<TR>
<TD><CODE>simplify</CODE></TD>
<TD><CODE>([error-bound,flags,tan_bounds,<BR>
linefixup,linelenmax])</CODE></TD>
<TD>Tries to remove excess points on the layer if doing so will not perturb
the curve by more than <CODE>error-bound</CODE>. Flags is a tuple of the
following strings
<DL>
<DT>
ignoreslopes
<DD>
Allow slopes to change
<DT>
ignoreextrema
<DD>
Allow removal of extrema
<DT>
smoothcurves
<DD>
Allow curve smoothing
<DT>
choosehv
<DD>
Snap to horizontal or vertical
<DT>
forcelines
<DD>
flatten bumps on lines
<DT>
nearlyhvlines
<DD>
Make nearly horizontal/vertical lines be so
<DT>
mergelines
<DD>
Merge adjacent lines into one
<DT>
setstarttoextremum
<DD>
Rotate the point list so that the start point is on an extremum
<DT>
removesingletonpoints
<DD>
If the contour contains just one point then remove it
</DL>
</TD>
</TR>
<TR>
<TD><CODE>stemControl</CODE></TD>
<TD><CODE>(stem_width_scale, [hscale, stem_height_scale, vscale,
xheight])</CODE></TD>
<TD>Allows you to scale counters and stems independently of each other.
<CODE>Stem_width_scale</CODE> specifies by how much the widths of stems should
be scaled (this should be a number around 1). If omitted <CODE>hscale</CODE>
defaults to 1, otherwise it will indicate the horizontal scaling factor for
the glyph as a whole. If omitted <CODE>stem_height_scale</CODE> defaults
to <CODE>stem_width_scale</CODE>, otherwise it specifies the scaling for
stem heights. If omitted <CODE>vscale</CODE> defaults to <CODE>hscale</CODE>,
otherwise it specifies the vertical scale factor for the glyph as a whole.
<P>
<CODE>Xheight</CODE> is optional, if specified it will fix the points at
that height so that they will be at the same level across glyphs.</TD>
</TR>
<TR>
<TD><CODE>stroke</CODE></TD>
<TD><CODE>("circular",width[,linecap,linejoin,flags])<BR>
("eliptical",width,minor-width,angle<BR>
[,linecap,linejoin,flags])<BR>
("caligraphic",width,height,angle[,flags])<BR>
("polygon",contour[,flags])</CODE></TD>
<TD>Strokes the current line using one of the indicated pens. Line cap may
be one of
<UL>
<LI>
butt
<LI>
round
<LI>
square
</UL>
<P>
line join may be
<UL>
<LI>
miter
<LI>
round
<LI>
bevel
</UL>
<P>
flags is a tuple containing some of the following strings
<UL>
<LI>
removeinternal
<LI>
removeexternal
<LI>
cleanup
</UL>
<P>
If a polygonal pen is specified the contour must be a closed, convex polygon
(no curved edges) with fewer than 100 vertices.</TD>
</TR>
<TR>
<TD><CODE>transform</CODE></TD>
<TD><CODE>(matrix)</CODE></TD>
<TD>Transforms the layer by the matrix</TD>
</TR>
<TR>
<TD><CODE>nltransform</CODE></TD>
<TD><CODE>(xexpr,yexpr)</CODE></TD>
<TD>xexpr and yexpr are strings specifying non-linear transformations that
will be applied to all points in the layer (with xexpr being applied to x
values, and yexpr to y values, of course). The syntax for the expressions
is explained in the <A HREF="transform.html#Non-Linear">non-linear transform
dialog</A>.</TD>
</TR>
<TR>
<TD><CODE>boundingBox</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a tuple representing a rectangle (xmin,ymin, xmax,ymax) into
which the layer fits. It is not guaranteed to be the smallest such rectangle,
but it will often be.</TD>
</TR>
<TR>
<TD><CODE>xBoundsAtY</CODE></TD>
<TD><CODE>(ybottom[,ytop])</CODE></TD>
<TD>Finds the minimum and maximum x positions attained by the contour when
y is between ybottom and ytop (if ytop is not specified it is assumed the
same as ybottom). If the layer does not have any y values in the specified
range then ff will return None.</TD>
</TR>
<TR>
<TD><CODE>yBoundsAtX</CODE></TD>
<TD><CODE>(xleft[,xright])</CODE></TD>
<TD>Finds the minimum and maximum y positions attained by the contour when
x is between xleft and xright (if xright is not specified it is assumed the
same as xleft). If the layer does not have any x values in the specified
range then ff will return None.</TD>
</TR>
<TR>
<TD><CODE>draw</CODE></TD>
<TD><CODE>(pen)</CODE></TD>
<TD>Draw the layer to the <A href="http://www.robofab.org/objects/pen.html">pen
argument.</A></TD>
</TR>
<TR>
<TH colspan=3>Pickling Methods</TH>
</TR>
<TR>
<TD><CODE>__reduce__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>This function allows the pickler to work on this type. I don't think
it is useful for anything else.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="GlyphPen">glyphPen</A>
</CAPTION>
<TR>
<TD colspan=3>This implements the
<A href="http://www.robofab.org/objects/pen.html">Pen Protocol</A> to draw
into a FontForge glyph. You create a glyphPen with the
<A href="#glyph-glyphPen">glyphPen</A> attribute of a glyph. You then draw
into it with the operators below.
<BLOCKQUOTE>
<PRE>
import fontforge;
font = fontforge.open("Ambrosia.sfd"); #Open a font
pen = font["B"].glyphPen(); # Create a pen to draw into glyph "B"
pen.moveTo((100,100)); # draw a square
pen.lineTo((100,200));
pen.lineTo((200,200));
pen.lineTo((200,100));
pen.closePath(); # end the contour
font["A"].draw(pen); # or you can copy from one glyph to another
# by having a glyph draw itself into the pen
pen = None; # Finalize the pen. This tells FontForge
# that the drawing is done and causes
# it to refresh the display (if a UI is active).
</PRE>
</BLOCKQUOTE>
<P>
This type may not be pickled.</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TD colspan=3>None</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>moveTo</CODE></TD>
<TD><CODE>((x,y))</CODE></TD>
<TD>With one exception this call begins every contor and creates an on curve
point at (x,y) as the start point of that contour. This should be the first
call after a pen has been created and the call that follows a closePath,
endPath.</TD>
</TR>
<TR>
<TD><CODE>lineTo</CODE></TD>
<TD><CODE>((x,y))</CODE></TD>
<TD>Draws a line from the last point to (x,y) and adds that to the contour.</TD>
</TR>
<TR>
<TD><CODE>curveTo</CODE></TD>
<TD><CODE>((cp1.x,cp1.y),(cp2.x,cp2.y),(x,y))<BR>
((cp.x,cp.y),(x,y))</CODE></TD>
<TD>This routine has slightly different arguments depending on the type of
the font. When drawing into a cubic font (PostScript) use the first set of
arguments (with two control points -- off curve points -- between each on
curve point). When drawing into a quadratic font (TrueType) use the second
format with one control point between adjacent on-curve points.
<P>
The standard appears to support super-bezier curves with more than two control
points between on-curve points. FontForge does not. Nor does FontForge allow
you to draw a quadratic spline into a cubic font, nor vice versa.</TD>
</TR>
<TR>
<TD><CODE>qCurveTo</CODE></TD>
<TD><CODE>([(cp.x,cp.y)]*,(x,y))<BR>
([(cp.x,cp.y)]*,None))</CODE></TD>
<TD>This routine may only be used in quadratic (TrueType) fonts and has two
different formats. It is used to express the TrueType idiom where an on-curve
point mid-way between its control points may be omitted, leading to a run
of off-curve points (with implied but unspecified on-curve points between
them).
<P>
The first format allows an arbetary number of off-curve points followed by
one on-curve point.
<P>
It is possible to have a contour which consists solely of off-curve points.
When this happens the contour is NOT started with a moveTo, instead the entire
contour, all the off curve points, are listed in one call, and the argument
list is terminated by a <CODE>None</CODE> to indicate there are no on-curve
points.</TD>
</TR>
<TR>
<TD><CODE>closePath</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Closes the contour (connects the last point to the first point to make
a loop) and ends it.</TD>
</TR>
<TR>
<TD><CODE>endPath</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Ends the contour without closing it. This is only relevant if you are
stroking contours.</TD>
</TR>
<TR>
<TD><CODE>addComponent</CODE></TD>
<TD><CODE>(glypn-name,transform)</CODE></TD>
<TD>Adds a reference (a component) to the glyph. The PostScript transformation
matrix is a 6 element tuple.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="Glyph">glyph</A>
</CAPTION>
<TR>
<TH colspan=3>Description</TH>
</TR>
<TR>
<TD colspan=3>The glyph type refers to a fontforge Glyph object. It has no
independent life of its own, it always lives within a font. It has all the
things you expect to be associated with a glyph: a glyph name, a unicode
encoding, a drawing layer, GPOS/GSUB features...
<P>
This type may not be pickled.
<P>
This type may not be created directly -- all glyphs are bound to a font and
must be created through the font.</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>activeLayer</CODE></TD>
<TD colspan=2>Returns currently active layer in the glyph (as an integer).
May be set to an integer or a layer name to change the active layer.</TD>
</TR>
<TR>
<TD><CODE><A name="g-altuni">altuni</A></CODE></TD>
<TD colspan=2>Returns additional unicode code points for this glyph.
For a primary code point, see <A HREF="#g-unicode">unicode</A>.
<P>
Returns either None or a tuple of alternate encodings. Each alternate
encoding is a tuple of<BR>
<CODE>(unicode-value, variation-selector, reserved-field)</CODE><BR>
The first is an unicode value of this alternate code point.
The second is an integer for variation selector and can be set to -1
if not used. The third is an empty field reserved for future use
and currently must be set to zero.
<P>
<CODE>glyph.altuni</CODE> can be set to None to clear all alternates,
or to a tuple. The elements of the tuple may be either integers
(an alternate unicode value with no variation selector)
or a tuple with up to 3 values in it as explained above.</TD>
</TR>
<TR>
<TD><CODE>anchorPoints</CODE></TD>
<TD colspan=2>Returns the list of anchor points in the glyph. Each anchor
point is a tuple of<BR>
<CODE>(anchor-class-name, type, x,y [,ligature-index])</CODE><BR>
The first two are strings, the next two doubles, and the last (which is only
present if type=="ligature") is an integer. Type may be
<UL>
<LI>
mark
<LI>
base
<LI>
ligature
<LI>
basemark
<LI>
entry
<LI>
exit
</UL>
</TD>
</TR>
<TR>
<TD><CODE>anchorPointsWithSel</CODE></TD>
<TD colspan=2>Same as the above, except also includes whether the anchor
point is selected in the UI. Returns a tuple of all anchor points in the
glyph. Each anchor point is a tuple of<BR>
<CODE>(anchor-class-name, type, x,y, selected [,ligature-index])</CODE><BR>
The first two are strings, the next two doubles, then a boolean, and the
last (which is only present if type=="ligature") is an integer. Type may
be
<UL>
<LI>
mark
<LI>
base
<LI>
ligature
<LI>
basemark
<LI>
entry
<LI>
exit
</UL>
</TD>
</TR>
<TR>
<TD><CODE><A name="g-background">background</A></CODE></TD>
<TD colspan=2>The glyph's background layer. This is a <EM>copy</EM> of the
glyph's data. See also <A href="#g-foreground">foreground</A>, and
<A HREF="python.html#glyph-layers">layers</A>.</TD>
</TR>
<TR>
<TD><CODE>changed</CODE></TD>
<TD colspan=2>Whether this glyph has been modified. This is (should be)
maintained automatically, but you may set it if you wish.</TD>
</TR>
<TR>
<TD><CODE>color</CODE></TD>
<TD colspan=2>The color of the glyph in the fontview. A 6 hex-digit RGB number
or -1 for default. 0xffffff is white, 0x0000ff is blue, etc.</TD>
</TR>
<TR>
<TD><CODE>comment</CODE></TD>
<TD colspan=2>Any comment you wish to associate with the glyph. UTF-8</TD>
</TR>
<TR>
<TD><CODE>dhints</CODE></TD>
<TD colspan=2>A tuple with one entry for each diagonal stem hint. Each stem
hint is itself represented by a tuple of three coordinate pairs (themselves
tuples of two numbers), these three are: a point on one side of the stem,
a point on the other side, and a unit vector pointing in the stem's direction.</TD>
</TR>
<TR>
<TD><CODE>encoding</CODE></TD>
<TD colspan=2>Returns the glyph's encoding in the font's encoding. (readonly)
<P>
If the glyph has multiple encodings, one will be picked at random.<BR>
If the glyph is not in the font's encoding then a number will be returned
beyond the encoding size (or in some cases -1 will be returned).</TD>
</TR>
<TR>
<TD><CODE>font</CODE></TD>
<TD colspan=2>The font containing this glyph. (readonly)</TD>
</TR>
<TR>
<TD><CODE><A name="g-foreground">foreground</A></CODE></TD>
<TD colspan=2>The glyph's foreground layer. This is a <EM>copy</EM> of the
glyph's data. See also <A href="#g-background">background</A>,
<A HREF="python.html#glyph-layers">layers</A> and
<A href="#g-references">references</A>.</TD>
</TR>
<TR>
<TD><CODE>glyphclass</CODE></TD>
<TD colspan=2>An opentype glyphclass, one of automatic, noclass, baseglyph,
baseligature, mark, component</TD>
</TR>
<TR>
<TD><CODE>glyphname</CODE></TD>
<TD colspan=2>The name of the glyph</TD>
</TR>
<TR>
<TD><CODE>hhints</CODE></TD>
<TD colspan=2>A tuple of all horizontal postscript hints. Each hint is itself
a tuple of starting locations and widths.</TD>
</TR>
<TR>
<TD><CODE>horizontalComponents</CODE></TD>
<TD colspan=2>A tuple of tuples.
<P>
This allows <A href="math.html#GlyphConstruction">constructing</A> very large
versions of the glyph by stacking the componants together. Some components
may be repeated so there is no bound on the size.
<P>
This is different from horizontalVariants which expects prebuilt glyphs of
various fixed sizes.
<P>
The components are stacked in the order they appear in the (top-level) tuple.
Each sub-tuple represents information on one component. The subtuple should
contain: (String glyph-name, Boolean is-extender, Int startConnectorLength,
Int endConnectorLength, Int fullAdvance). Any of these may be omitted (except
the glyph name) and will be assumed to be 0 if so.</TD>
</TR>
<TR>
<TD><CODE>horizontalComponentItalicCorrection</CODE></TD>
<TD colspan=2>The italic correction for any composite glyph made with the
horizontalComponents.</TD>
</TR>
<TR>
<TD><CODE>horizontalVariants</CODE></TD>
<TD colspan=2>A string containing a list of glyph names. These are
<A href="math.html#Variants</a">alternate forms</A> of the current glyph
for use in typesetting math. Presumably the variants are of different sizes.
<P>
Although ff will always return a string of glyph names, you may assign to
it with a tuple of glyphs and ff will convert that to corresponding names.</TD>
</TR>
<TR>
<TD><CODE>isExtendedShape</CODE></TD>
<TD colspan=2>A boolean containing the MATH "is extended shape" field.</TD>
</TR>
<TR>
<TD><CODE>italicCorrection</CODE></TD>
<TD colspan=2>The glyph's italic correction field. Used by both TeX and MATH.
The special value fontforge.unspecifiedMathValue means the value is unspecified (An
unspecified value will not go into the output tables, a value of 0 will)</TD>
</TR>
<TR>
<TD><CODE>layer_cnt</CODE></TD>
<TD colspan=2>The number of layers in this glyph. (Cannot be set)</TD>
</TR>
<TR>
<TD><CODE><A NAME="glyph-layers">layers</A></CODE></TD>
<TD colspan=2>A dictionary like object containing the layers of the glyph.
It may be indexed by either a layer name, or an integer between 0 and
<CODE>glyph.layer_cnt-1</CODE> to produce a <A href="#Layer">Layer</A> object.
Layer 0 is the background layer. Layer 1 is the foreground layer.</TD>
</TR>
<TR>
<TD><CODE><A NAME="layerrefs">layerrefs</A></CODE></TD>
<TD colspan=2>A dictionary like object containing the references in the layers
of the glyph. It may be indexed by either a layer name, or an integer between
0 and <CODE>glyph.layer_cnt-1</CODE> to produce a
<A href="#g-references">reference tuple</A> object. Layer 0 is the background
layer. Layer 1 is the foreground layer.</TD>
</TR>
<TR>
<TD><CODE>lcarets</CODE></TD>
<TD colspan=2>A tuple containing the glyph's ligature caret locations. Setting
this will also either enable or disable the "Default Ligature Caret Count"
flag depending from the number of elements in the tuple.</TD>
</TR>
<TR>
<TD><CODE>left_side_bearing</CODE></TD>
<TD colspan=2>The left side bearing of the glyph. Setting this value will adjust all layers
so that guides in the background etc will be adjusted with the rest of the glyph</TD>
</TR>
<TR>
<TD><CODE>manualHints</CODE></TD>
<TD colspan=2>The glyph's hints have been set by hand, and the glyph should
not be autohinted without a specific request from the user. The "Don't AutoHint"
flag.</TD>
</TR>
<TR>
<TD><CODE>mathKern.bottomLeft</CODE></TD>
<TD colspan=2>The glyph's math kerning data associated with the bottom left
vertex. This returns a tuple of two element tuples, each of which contains
a kerning offset and an associated height (in the last entry the height term
is meaningless, but present).</TD>
</TR>
<TR>
<TD><CODE>mathKern.bottomRight</CODE></TD>
<TD colspan=2>The glyph's math kerning data associated with the bottom right
vertex. This returns a tuple of two element tuples, each of which contains
a kerning offset and an associated height (in the last entry the height term
is meaningless, but present).</TD>
</TR>
<TR>
<TD><CODE>mathKern.topLeft</CODE></TD>
<TD colspan=2>The glyph's math kerning data associated with the top left
vertex. This returns a tuple of two element tuples, each of which contains
a kerning offset and an associated height (in the last entry the height term
is meaningless, but present).</TD>
</TR>
<TR>
<TD><CODE>mathKern.topRight</CODE></TD>
<TD colspan=2>The glyph's math kerning data associated with the top right
vertex. This returns a tuple of two element tuples, each of which contains
a kerning offset and an associated height (in the last entry the height term
is meaningless, but present).</TD>
</TR>
<TR>
<TD><CODE>originalgid</CODE></TD>
<TD colspan=2>The GID of this glyph in the font it was read from. (readonly)</TD>
</TR>
<TR>
<TD><CODE><A NAME="glyph-persistent">persistent</A></CODE></TD>
<TD colspan=2>Whatever you want (these data will be saved as a pickled object
in the sfd file. It is your job to insure that whatever you put here can
be pickled). See also <A HREF="#glyph-temporary">the temporary</A> field.</TD>
</TR>
<TR>
<TD><CODE><A name="g-references">references</A></CODE></TD>
<TD colspan=2>A tuple of tuples containing glyph-name and a transformation
matrix for each reference in the foreground. See also
<A href="#g-foreground">foreground</A> and
<A HREF="python.html#layerrefs">layerrefs</A>.</TD>
</TR>
<TR>
<TD><CODE>right_side_bearing</CODE></TD>
<TD colspan=2>The right side bearing of the glyph</TD>
</TR>
<TR>
<TD><CODE>script</CODE></TD>
<TD colspan=2>A string containing the OpenType 4 letter tag for the script
associated with this glyph (readonly)</TD>
</TR>
<TR>
<TD><CODE><A NAME="glyph-temporary">temporary</A></CODE></TD>
<TD colspan=2>Whatever you want (these data will be lost once the font is
closed) See also <A HREF="#glyph-persistent">the persistent</A> field.</TD>
</TR>
<TR>
<TD><CODE>texheight</CODE></TD>
<TD colspan=2>The Tex height. The special value fontforge.unspecifiedMathValue means
the field is unspecified (An unspecified value will not go into the output
tables, a value of 0 will)</TD>
</TR>
<TR>
<TD><CODE>texdepth</CODE></TD>
<TD colspan=2>The Tex depth. The special value fontforge.unspecifiedMathValue means the
field is unspecified (An unspecified value will not go into the output tables,
a value of 0 will)</TD>
</TR>
<TR>
<TD><CODE>topaccent</CODE></TD>
<TD colspan=2>The glyph's top accent position field. Used by MATH. The special
value fontforge.unspecifiedMathValue means the field is unspecified (An unspecified value
will not go into the output tables, a value of 0 will)</TD>
</TR>
<TR>
<TD><CODE>ttinstrs</CODE></TD>
<TD colspan=2>Any truetype instructions, returned as a binary string</TD>
</TR>
<TR>
<TD><CODE><A name="g-unicode">unicode</A></CODE></TD>
<TD colspan=2>The glyph's unicode code point, or -1.
In addition to this primary mapping, a glyph can have multiple
secondary mappings - see <A HREF="#g-altuni">altuni</A>.
</TD>
</TR>
<TR>
<TD><CODE>unlinkRmOvrlpSave</CODE></TD>
<TD colspan=2>A flag that indicates the glyph's references should be unlinked
and remove overlap run on it before the font is saved (and then the original
references replaced after the save finishes)</TD>
</TR>
<TR>
<TD><CODE>userdata</CODE></TD>
<TD colspan=2>Deprecated name for <A HREF="#glyph-temporary">temporary field
above</A></TD>
</TR>
<TR>
<TD><CODE>vhints</CODE></TD>
<TD colspan=2>A tuple of all vertical postscript hints. Each hint is itself
a tuple of starting locations and widths.</TD>
</TR>
<TR>
<TD><CODE><A NAME="validation-state">validation</A>_state</CODE></TD>
<TD colspan=2>A bit mask indicating some problems this glyph might have.
(readonly)
<TABLE BORDER CELLPADDING="2">
<TR>
<TD>0x1</TD>
<TD>If set then this glyph has been validated.<BR>
If unset then other bits are meaningless.</TD>
</TR>
<TR>
<TD>0x2</TD>
<TD>Glyph has an open contour.</TD>
</TR>
<TR>
<TD>0x4</TD>
<TD>Glyph intersects itself somewhere.</TD>
</TR>
<TR>
<TD>0x8</TD>
<TD>At least one contour is drawn in the wrong direction</TD>
</TR>
<TR>
<TD>0x10</TD>
<TD>At least one reference in the glyph has been flipped<BR>
(and so is drawn in the wrong direction)</TD>
</TR>
<TR>
<TD>0x20</TD>
<TD>Missing extrema</TD>
</TR>
<TR>
<TD>0x40</TD>
<TD>A glyph name referred to from this glyph, in an opentype table, is not
present in the font.</TD>
</TR>
<TR>
<TD>0x40000</TD>
<TD>Points (or control points) are too far apart. (Coordinates must be within
32767)</TD>
</TR>
<TR>
<TH COLSPAN=2>PostScript only</TH>
</TR>
<TR>
<TD>0x80</TD>
<TD>PostScript has a limit of 1500 points in a glyph.</TD>
</TR>
<TR>
<TD>0x100</TD>
<TD>PostScript has a limit of 96 hints in a glyph.</TD>
</TR>
<TR>
<TD>0x200</TD>
<TD>Invalid glyph name.</TD>
</TR>
<TR>
<TH COLSPAN=2>TrueType only, errors in original file</TH>
</TR>
<TR>
<TD>0x400</TD>
<TD>More points in a glyph than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x800</TD>
<TD>More paths in a glyph than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x1000</TD>
<TD>More points in a composite glyph than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x2000</TD>
<TD>More paths in a composite glyph than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x4000</TD>
<TD>Instructions longer than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x8000</TD>
<TD>More references in a glyph than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x10000</TD>
<TD>References nested more deeply than allowed in 'maxp'</TD>
</TR>
<TR>
<TD>0x40000</TD>
<TD>Points too far apart. TrueType and Type2 fonts are limited to 16 bit
numbers, and so adjacent points must be within 32767 em-units of each other.</TD>
</TR>
<TR>
<TD>0x80000</TD>
<TD>Points non-integral. TrueType points and control points must be integer
aligned. (FontForge will round them if they aren't)</TD>
</TR>
<TR>
<TD>0x100000</TD>
<TD>Missing anchor. According to the opentype spec, if a glyph contains an
anchor point for one anchor class in a subtable, it must contain anchor points
for all anchor classes in the subtable. Even it, logically, they do not apply
and are unnecessary.</TD>
</TR>
<TR>
<TD>0x200000</TD>
<TD>Duplicate glyph name. Two (or more) glyphs in this font have the same
name. When outputting a PostScript font only one of them will ever be seen.
<P>
It's a little hard to detect this in normal use, but if you change the encoding
to "Glyph Order", and then use Edit->Select->Wildcard and enter the
glyph name, both of them should be selected.</TD>
</TR>
<TR>
<TD>0x400000</TD>
<TD>Duplicate unicode code point. Two (or more) glyphs in this font have
the code point. When outputting an sfnt (TrueType/OpenType) font only one
of them will ever be seen.
<P>
It's a little hard to detect this in normal use, but if you change the encoding
to "Glyph Order", and then use Edit->Select->Wildcard and enter the
code point, both of them should be selected.</TD>
</TR>
<TR>
<TD>0x800000</TD>
<TD>Overlapped hints. Either the glyph has no hint masks and there are overlapped
hints, or a hint mask specifies two overlapping hints.</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE>verticalComponents</CODE></TD>
<TD colspan=2>A tuple of tuples.
<P>
This allows <A href="math.html#GlyphConstruction">constructing</A> very large
versions of the glyph by stacking the componants together. Some components
may be repeated so there is no bound on the size.
<P>
This is different from verticalVariants which expects prebuilt glyphs of
various fixed sizes.
<P>
The components are stacked in the order they appear in the (top-level) tuple.
Each sub-tuple represents information on one component. The subtuple should
contain: (String glyph-name, Boolean is-extender, Int startConnectorLength,
Int endConnectorLength, Int fullAdvance). Any of these may be omitted (except
the glyph name) and will be assumed to be 0 if so.</TD>
</TR>
<TR>
<TD><CODE>verticalComponentItalicCorrection</CODE></TD>
<TD colspan=2>The italic correction for any composite glyph made with the
verticalComponents.</TD>
</TR>
<TR>
<TD><CODE>verticalVariants</CODE></TD>
<TD colspan=2>A string containing a list of glyph names. These are
<A href="math.html#Variants</a">alternate forms</A> of the current glyph
for use in typesetting math. Presumably the variants are of different sizes.</TD>
</TR>
<TR>
<TD><CODE><A name="g-width">width</A></CODE></TD>
<TD colspan=2>The advance width of the glyph. See also
<A HREF="#g-vwidth">vwidth</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="g-vwidth">vwidth</A></CODE></TD>
<TD colspan=2>The vertical advance width of the glyph. See also
<A HREF="#g-width">width</A>.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>addAnchorPoint</CODE></TD>
<TD><CODE>(anchor-class-name,<BR>
anchor-type,<BR>
x,y<BR>
[,ligature-index])</CODE></TD>
<TD>Adds an anchor point. anchor-type may be one of the strings
<UL>
<LI>
"mark"
<LI>
"base"
<LI>
"ligature"
<LI>
"basemark"
<LI>
"entry"
<LI>
"exit"
</UL>
<P>
If there is an anchor point with the same anchor-class-name and:
<UL>
<LI>
lookup type is "gpos_mark2base" or
<LI>
lookup type is "gpos_mark2ligature" and ligature-index is the same or
<LI>
anchor-type is the same
</UL>
<P>
then the existing anchor will be overwritten.</TD>
</TR>
<TR>
<TD><CODE>addExtrema</CODE></TD>
<TD><CODE>([flags,emsize])</CODE></TD>
<TD>Extrema should be marked by on-curve points. If a curve lacks a point
at an extrema this command will add one. Flags may be one of the following
strings
<DL>
<DT>
all
<DD>
Add all missing extrema
<DT>
only_good
<DD>
Only add extrema on longer splines (with respect to the em-size)
<DT>
only_good_rm
<DD>
As above but also merge away on-curve points which are very close to, but
not on, an added extremum
</DL>
</TD>
</TR>
<TR>
<TD><CODE>addReference</CODE></TD>
<TD><CODE>(glyph-name[,transform])</CODE></TD>
<TD>Adds a reference to the specified glyph into the current glyph. Optionally
specifying a transformation matrix</TD>
</TR>
<TR>
<TD><CODE>addHint</CODE></TD>
<TD><CODE>(is-vertical,start,width)</CODE></TD>
<TD>Adds a postscript hint. Takes a boolean flag indicating whether the hint
is horizontal or vertical, a start location and the hint's width.</TD>
</TR>
<TR>
<TD><CODE>addPosSub</CODE></TD>
<TD><CODE>(subtable-name,variant)<BR>
(subtable-name,variants)<BR>
(subtable-name,ligature-components)<BR>
(subtable-name,xoff,yoff,xadv,yadv)<BR>
(subtable-name,other-glyph-name,kerning)<BR>
(subtable-name,other-glyph-name, xoff1,yoff1,xadv1,yadv1,<BR>
xoff2,yoff2,xadv2,yadv2)</CODE></TD>
<TD>Adds position/substitution data to the glyph. The number and type of
the arguments vary acording to the type of the lookup containing the subtable.
The first argument should always be a lookup subtable name. If the lookup
is for single substitutions then the second argument should be a string
containing a single glyph name. For multiple and alternated substitutions
a tuple of glyph names. For ligatures, a tuple of the ligature components
(glyph names). For single positionings the second through fifth arguments
should be small integers representing the adjustment along the appropriate
axis. For pairwise positionings (kerning) the second argument should be the
name of the other glyph being kerned with, and the third through tenth should
be small integers -- or, if there are exactly three arguments then the third
specifies traditional, one-axis, kerning
<P>
If there is a previously existing entry, this will replace it (except for
ligatures).</TD>
</TR>
<TR>
<TD><CODE>appendAccent</CODE></TD>
<TD><CODE>(name="glyph-name")<BR>
(unicode=<codepoint>)</CODE></TD>
<TD>Makes a reference to the specified glyph, adds that reference to the
current layer of this glyph, and positions it to make a reasonable accent.</TD>
</TR>
<TR>
<TD><CODE>autoHint</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Generates PostScript hints for this glyph.</TD>
</TR>
<TR>
<TD><CODE>autoInstr</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Generates TrueType instructions for this glyph.</TD>
</TR>
<TR>
<TD><CODE>autoTrace</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Auto traces any background images</TD>
</TR>
<TR>
<TD><CODE>boundingBox</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns a tuple representing a rectangle (xmin,ymin, xmax,ymax) which
is the minimum bounding box of the glyph.</TD>
</TR>
<TR>
<TD><CODE>build</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>If the character is a composite character, then clears it and inserts
references to its components</TD>
</TR>
<TR>
<TD><CODE>canonicalContours</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Orders the contours in the current glyph by the x coordinate of their
leftmost point. (This can reduce the size of the charstring needed to describe
the glyph(s).</TD>
</TR>
<TR>
<TD><CODE>canonicalStart</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Sets the start point of all the contours of the current glyph to be the
leftmost point on the contour. (If there are several points with that value
then use the one which is closest to the baseline). This can reduce the size
of the charstring needed to describe the glyph(s). By regularizing things
it can also make more things available to be put in subroutines.</TD>
</TR>
<TR>
<TD><CODE>changeWeight</CODE></TD>
<TD><CODE>(stroke_width[,type,<BR>
serif_height,serif_fuzz,<BR>
counter_type,custom_zones])</CODE></TD>
<TD>See the <A HREF="Styles.html#Embolden">Element->Style->Change
Width</A> command for a more complete description of these arguments.
<P>
Stroke_width is the amount by which all stems are expanded.
<P>
Type is one of "LCG", "CJK", "auto", "custom".
<P>
Serif_height tells ff not to expand serifs which are that much off the baseline,
while serif_fuzz specifies the amount of fuzziness allowed in the match.
If you don't want special serif behavior set this to 0.
<P>
Counter_type is one of "squish", "retain", "auto".
<P>
Custom_zones is only meaningful if the type argument were "custom". It may
be either a number, which specifies the "top hint" value (bottom hint is
assumed to be 0, others are between), or a tuple of 4 numbers (top hint,
top zone, bottom zone, bottom hint).</TD>
</TR>
<TR>
<TD><CODE>condenseExtend</CODE></TD>
<TD><CODE>(c_factor,c_add[,sb_factor,sb_add,correct])</CODE></TD>
<TD>Condenses or extends the size of the counters and side-bearings of the
glyph. The first two arguments provide information on shrinking/growing the
counters, the second two the sidebearings. If the last two are omitted they
default to the same values as the first two.
<P>
A counter's width will become:<BR>
<CODE> new_width = c_factor * old_width + c_add</CODE>
<P>
If present the <CODE>correct</CODE> argument allows you to specify whether
you want to correct for the italic angle before condensing the glyph. (it
defaults to True)</TD>
</TR>
<TR>
<TD><CODE>clear</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Clears the contents of the glyph (and marks it as not
<A href="#g-isWorthOutputting">worth outputting</A>).</TD>
</TR>
<TR>
<TD><CODE><A name="g-cluster">cluster</A></CODE></TD>
<TD><CODE>([within,max])</CODE></TD>
<TD>Moves clustered coordinates to a standard central value. See also
<A href="#g-round">round</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="g-correctDirection">correctDirection</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Orients all contours so that external ones are clockwise and internal
counter-clockwise.</TD>
</TR>
<TR>
<TD><CODE><A name="g-exclude">exclude</A></CODE></TD>
<TD><CODE>(excluded-layer)</CODE></TD>
<TD>Removes the excluded area from the current glyph. Takes an argument which
is a layer. See also <A href="#g-removeOverlap">removeOverlap</A> and
<A href="#g-intersect">intersect</A>.</TD>
</TR>
<TR>
<TD><CODE>export</CODE></TD>
<TD><TABLE>
<TR>
<TD><CODE>(filename[,pixelsize,bitdepth])</CODE></TD>
<TD>bitmap images</TD>
</TR>
<TR>
<TD><CODE> (filename[,layer])</CODE></TD>
<TD>vector outlines</TD>
</TR>
</TABLE>
</TD>
<TD>Uses the file's extension to determine output file type. Exports outline
formats to the file. For bitmap formats it will rasterize the glyph and output
that. There are different optional arguments for rasterizing images and for
direct outline output. bitdepth must be 1 or 8.</TD>
</TR>
<TR>
<TD><CODE>getPosSub</CODE></TD>
<TD><CODE>(lookup-subtable-name)</CODE></TD>
<TD>Returns any positioning/substitution data attached to the glyph controlled
by the lookup-subtable. If the name is "*" then returns data from all subtables.
<P>
The data are returned as a tuple of tuples. The first element of the subtuples
is the name of the lookup-subtable. The second element will be one of the
strings: "Position", "Pair", "Substitution", "AltSubs", "MultSubs","Ligature".
<P>
Positioning data will be followed by four small integers representing adjustments
to the: x position of the glyph, the y position, the horizontal advance,
and the vertical advance.
<P>
Pair data will be followed by the name of the other glyph in the pair and
then eight small integers representing adjustments to the: x position of
the first glyph, the y position, the horizontal advance, and the vertical
advance, and then a similar foursome for the second glyph.
<P>
Substitution data will be followed by a string containing the name of the
glyph to replace the current one.
<P>
Multiple and Alternate data will be followed by several strings each containing
the name of a replacement glyph.
<P>
Ligature data will be followed by several strings each containing the name
of a ligature component glyph.</TD>
</TR>
<TR>
<TD><CODE>importOutlines</CODE></TD>
<TD><CODE>(filename,[flags])</CODE></TD>
<TD>Uses the file's extension to determine behavior. Imports outline descriptions
(eps, svg, glif files) into the forground layer. Imports image descriptions
(bmp, png, xbm, etc.) into the background layer. Optionally, flags can be
used to control PostScript import, it'll be ignored for other file types.
Flags is a tuple of the following strings
<DL>
<DT>
toobigwarn
<DD>
Supress warning window about too big stroke width
<DT>
removeoverlap
<DD>
When FontForge detects that an expanded stroke will self-intersect, then
setting this flag will cause it to try to make things nice by removing the
intersections
<DT>
handle_eraser
<DD>
Certain programs use pens with white ink as erasers. When this flag is set,
FontForge will attempt to simulate that.
<DT>
correctdir
<DD>
</DL>
</TD>
</TR>
<TR>
<TD><CODE><A name="g-intersect">intersect</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Leaves only areas in the intersection of contours. See also
<A href="#g-removeOverlap">removeOverlap</A> and
<A href="#g-exclude">exclude</A>.</TD>
</TR>
<TR>
<TD><CODE><A name="g-isWorthOutputting">isWorthOutputting</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether the glyph is worth outputting into a font file. Basically
a glyph is worth outputting if it contains any contours, or references or
has had its width set.</TD>
</TR>
<TR>
<TD><CODE>preserveLayerAsUndo</CODE></TD>
<TD><CODE>([layer,dohints])</CODE></TD>
<TD>Normally undo handling is turned off during python scripting. If you
wish you may tell fontforge to preserve the current state of a layer so that
whatever you do later can be undone by the user. You may omit the layer parameter
(in which case the currently active layer will be used). You may also request
that hints be preserved (they are not, by default).</TD>
</TR>
<TR>
<TD><CODE><A name="g-removeOverlap">removeOverlap</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes overlapping areas. See also <A href="#g-intersect">intersect</A>
and <A href="#g-exclude">exclude</A>.</TD>
</TR>
<TR>
<TD><CODE>removePosSub</CODE></TD>
<TD><CODE>(lookup-subtable-name)</CODE></TD>
<TD>Removes all data from the glyph corresponding to the given lookup-subtable.
If the name is "*" then all data will be removed.</TD>
</TR>
<TR>
<TD><CODE><A name="g-round">round</A></CODE></TD>
<TD><CODE>([factor])</CODE></TD>
<TD>Rounds the x and y coordinates of each point in the glyph. If factor
is specified then new-coord = round(factor*old-coord)/factor. See also
<A href="#g-cluster">cluster</A>.</TD>
</TR>
<TR>
<TD><CODE>selfIntersects</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether any of the contours in this glyph intersects any other
contour in the glyph (including itself).</TD>
</TR>
<TR>
<TD><CODE>simplify</CODE></TD>
<TD><CODE>([error-bound,flags,tan_bounds,<BR>
linefixup,linelenmax])</CODE></TD>
<TD>Tries to remove excess points in the glyph if doing so will not perturb
the curve by more than <CODE>error-bound</CODE>. Flags is a tuple of the
following strings
<DL>
<DT>
ignoreslopes
<DD>
Allow slopes to change
<DT>
ignoreextrema
<DD>
Allow removal of extrema
<DT>
smoothcurves
<DD>
Allow curve smoothing
<DT>
choosehv
<DD>
Snap to horizontal or vertical
<DT>
forcelines
<DD>
flatten bumps on lines
<DT>
nearlyhvlines
<DD>
Make nearly horizontal/vertical lines be so
<DT>
mergelines
<DD>
Merge adjacent lines into one
<DT>
setstarttoextremum
<DD>
Rotate the point list so that the start point is on an extremum
<DT>
removesingletonpoints
<DD>
If the contour contains just one point then remove it
</DL>
</TD>
</TR>
<TR>
<TD><CODE>stroke</CODE></TD>
<TD><CODE>("circular",width[,linecap,linejoin,flags])<BR>
("eliptical",width,minor-width,angle<BR>
[,linecap,linejoin,flags])<BR>
("caligraphic",width,height,angle[,flags])<BR>
("polygonal",contour[,flags])</CODE></TD>
<TD>Strokes the contours of the glyph using one of the indicated pens. Line
cap may be one of
<UL>
<LI>
butt
<LI>
round
<LI>
square
</UL>
<P>
line join may be
<UL>
<LI>
miter
<LI>
round
<LI>
bevel
</UL>
<P>
flags is a tuple containing some of the following strings
<UL>
<LI>
removeinternal
<LI>
removeexternal
<LI>
cleanup
</UL>
<P>
If a polygonal pen is specified, the contour must be a closed convex polygon
(no curved edges) with fewer than 100 vertices.</TD>
</TR>
<TR>
<TD><CODE>transform</CODE></TD>
<TD><CODE>(matrix[,flags])</CODE></TD>
<TD>Transforms the glyph by the matrix. The optional flags argument should
be a tuple containing any of the following strings:
<UL>
<LI>
partialRefs -- Don't transform any references in the glyph, but do transform
their offsets. This is useful if the refered glyph will be (or has been)
transformed.
<LI>
round -- Round to int after the transformation is done.
</UL>
</TD>
</TR>
<TR>
<TD><CODE>nltransform</CODE></TD>
<TD><CODE>(xexpr,yexpr)</CODE></TD>
<TD>xexpr and yexpr are strings specifying non-linear transformations that
will be applied to all points in the current layer (with xexpr being applied
to x values, and yexpr to y values, of course). The syntax for the expressions
is explained in the <A HREF="transform.html#Non-Linear">non-linear transform
dialog</A>.</TD>
</TR>
<TR>
<TD><CODE>unlinkRef</CODE></TD>
<TD><CODE>([ref-name])</CODE></TD>
<TD>Unlinks the reference to the glyph named <CODE>ref-name</CODE>. If
<CODE>ref-name</CODE> is omitted, unlinks all references.</TD>
</TR>
<TR>
<TD><CODE>unlinkThisGlyph</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Unlinks all the references to the current glyph within any other glyph
in the font.</TD>
</TR>
<TR>
<TD><CODE>useRefsMetrics</CODE></TD>
<TD><CODE>(ref-name[,flag])</CODE></TD>
<TD>Finds a reference with the given name and sets the "use_my_metrics" flag
on it (so this glyph will have the same advance width as the glyph the reference
points to).
<P>
If the optional flag argument is False, then the glyph will no longer have
its metrics bound to the reference.</TD>
</TR>
<TR>
<TD><CODE>validate</CODE></TD>
<TD><CODE>([force])</CODE></TD>
<TD>Validates the glyph and returns the
<CODE><A HREF="python.html#validation-state">validation_state</A></CODE>
of the glyph (except bit 0x1 will always be clear). If the glyph passed the
validation then the return value will be 0 (not 0x1). Otherwise the return
value will be the set of errors found. If force is specified true this will
always be validated, if force is unspecified (or specified as false) then
it will return the cached value if it is known, otherwise will validate it.</TD>
</TR>
<TR>
<TD><CODE>draw</CODE></TD>
<TD><CODE>(pen)</CODE></TD>
<TD>Draw the glyph's outline to the
<A href="http://www.robofab.org/objects/pen.html">pen argument.</A></TD>
</TR>
<TR>
<TD><CODE><A name="glyph-glyphPen">glyphPen</A></CODE></TD>
<TD><CODE>([replace=False])</CODE></TD>
<TD>Creates a new glyphPen which will draw into the current glyph. By default
the pen will replace any existing contours and references, but setting the
optional keyword argument, <CODE>replace</CODE> to false will retain the
old contents.</TD>
</TR>
<TR>
<TD colspan=3><STRONG>Note:</STRONG> Glyphs do not have an independent existence.
They live in fonts. You may not create them with stand-alone, only in the
context of a font. See <A href="#f-createChar">font.createChar</A></TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="selection">selection</A>
</CAPTION>
<TR>
<TD colspan=3>This represents a font's selection. You may index it with an
encoding value (in the encoding ISO-646-US (ASCII) the character "A" has
encoding index 65), or with a glyph's name, or with a string like "uXXXXX"
where XXXXX represent the glyph's unicode codepoint in hex, or with a fontforge
glyph object. The value of indexing into a selection will be either True
or False.
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">>>></FONT> print fontforge.activeFont().selection[65]
<FONT COLOR="Gray">True</FONT>
</PRE>
</BLOCKQUOTE>
<P>
This type may not be pickled.</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>byGlyphs</CODE></TD>
<TD colspan=2>Returns another selection, just the same as this one except
that its iterator function will return glyphs (rather than encoding slots)
and will only return those entries for which glyphs exist. (This is read
only)</TD>
</TR>
<TR>
<TH colspan=3>Iterator Protocol</TH>
</TR>
<TR>
<TD><CODE>__iter__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns an iterator for the selection which will return all selected
encoding slots in encoding order.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>all</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Select everything.</TD>
</TR>
<TR>
<TD><CODE>none</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Deselect everything.</TD>
</TR>
<TR>
<TD><CODE>changed</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Select all glyphs which have changed.</TD>
</TR>
<TR>
<TD><CODE>invert</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Invert the selection.</TD>
</TR>
<TR>
<TD><CODE>select</CODE></TD>
<TD><CODE>(args)</CODE></TD>
<TD>There may be an arbitrary number of arguments. Each argument may be either:
<UL>
<LI>
A glyph name<BR>
Note: There need not be a glyph with this name in the font yet, but if you
use a standard name (like "A") fontforge will still know where that glyph
should be.
<LI>
An integer (this will be interpreted as either an encoding index or (default)
a unicode code point depending on the flags).
<LI>
A fontforge glyph.
<LI>
A tuple of flags.<BR>
(If you wish to specify a single flag it must still be in a tuple, and you
must append a trailing comma to the flag (so <CODE>("more",) </CODE>rather
than just <CODE>("more")</CODE>). FF needs the flags to
be in a tuple otherwise it can't distinguish them from glyph names)
<DL>
<DT>
unicode
<DD>
Interpret integer arguments as unicode code points
<DT>
encoding
<DD>
Interpret integer arguments as encoding indeces.
<DT>
more
<DD>
Specified items should be selected
<DT>
less
<DD>
Specified items should be deselected.
<DT>
singletons
<DD>
Specified items should be interpreted individually and mean the obvious.
<DT>
ranges
<DD>
Specified items should be interpreted in pairs and represent all encoding
slots between the start and end points specified by the pair. So
<CODE>.select(("ranges",None),"A","Z")</CODE> would select all the upper
case (latin) letters.
</DL>
</UL>
<P>
If the first argument is not a flag argument (or if it doesn't specify either
"more" or "less") then the selection will be cleared. So
<CODE>.select("A")</CODE> would produce a selection with only "A" selected,
<CODE>.select(("more",None),"A")</CODE> would add "A" to the current selection,
while <CODE>.select(("less",None),"A")</CODE> would remove "A" from the current
selection.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A NAME="private">private</A>
</CAPTION>
<TR>
<TD colspan=3>This represents a font's postscript private dictionary. You
may index it with one of the standard names of things that live in the private
dictionary.
<P>
This type may not be pickled.</TD>
</TR>
<TR>
<TH colspan=3>Iterator Protocol</TH>
</TR>
<TR>
<TD><CODE>__iter__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns an iterator for the dictionary which will return all entres.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>guess</CODE></TD>
<TD><CODE>(name)</CODE></TD>
<TD>Guess a value for this this entry in the private dictionary. If fontforge
can't make a guess it will simply ignore the request.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A NAME="math">math</A>
</CAPTION>
<TR>
<TD colspan=3>This represents a font's math constant table. Not all fonts
have math tables, and checking this field will not create the underlying
object, but examining or assigning to its members will create it..
<P>
This type may not be pickled.</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TD colspan=3>Any of the math constant names may be used as member names.<BR>
The list is long, and I shall not copy them all. Here is a subset<BR>
<CODE>ScriptPercentScaleDown<BR>
ScriptScriptPercentScaleDown<BR>
DelimitedSubFormulaMinHeight<BR>
...</CODE><BR>
(These names begin with capital letters, not Python's conventions but
Microsoft's)<BR>
These all take (16 bit) integer values.<BR>
I do not currently provide python access to any associated device tables.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>exists</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns whether the font currently has an underlying math table associated
with it. Note that examining or assigning to one of the members will create
such a table.</TD>
</TR>
<TR>
<TD><CODE>clear</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes any underlying math table from the font.</TD>
</TR>
</TABLE>
<P>
<TABLE id="type" border=1>
<CAPTION>
<A name="Font">font</A>
</CAPTION>
<TR>
<TH colspan=3>Description</TH>
</TR>
<TR>
<TD colspan=3>The font type refers to a fontforge Font object. It generally
contains a list of glyphs, an encoding to order those glyphs, a fontname,
a list of GPOS/GSUB lookups and many other things.
<P>
This type may not be pickled.</TD>
</TR>
<TR>
<TH colspan=3>Creation</TH>
</TR>
<TR>
<TD><CODE>fontforge.font</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Creates a new font</TD>
</TR>
<TR>
<TH colspan=3>Members</TH>
</TR>
<TR>
<TH>member</TH>
<TH colspan=2>comments</TH>
</TR>
<TR>
<TD><CODE>activeLayer</CODE></TD>
<TD colspan=2>Returns currently active layer in the font (as an integer).
May be set to an integer or a layer name to change the active layer.</TD>
</TR>
<TR>
<TD><CODE>ascent</CODE></TD>
<TD colspan=2>The font's ascent</TD>
</TR>
<TR>
<TD><CODE>bitmapSizes</CODE></TD>
<TD colspan=2>A tuple with an entry for each bitmap strike attached to the
font. Each strike is identified by pixelsize (if the strike is a grey scale
font it will be indicated by
<CODE>(bitmap-depth<<16)|pixelsize</CODE>.
<P>
When setting this value pass in a tuple of the same format. Any existing
strike not specified in the tuple will be removed. Any new sizes will be
created (but not rasterized -- use <A href="#f-regenBitmaps">regenBitmaps</A>
for that).</TD>
</TR>
<TR>
<TD><CODE>capHeight</CODE></TD>
<TD colspan=2>(readonly) Computes the Cap Height (the height of capital letters
such as "E"). A negative number indicates the value could not be computed
(the font might have no capital letters because it was lower case only, or
didn't include glyphs for a script with capital letters).</TD>
</TR>
<TR>
<TD><CODE>changed</CODE></TD>
<TD colspan=2>Bit indicating whether the font has been modified. This is
(should be) maintained automatically, but you may set it if you wish.</TD>
</TR>
<TR>
<TD><CODE>cidcopyright</CODE></TD>
<TD COLSPAN=2>Copyright message of the cid-keyed font as a whole (ie. not
the current subfont).</TD>
</TR>
<TR>
<TD><CODE>cidfamilyname</CODE></TD>
<TD COLSPAN=2>Family name of the cid-keyed font as a whole (ie. not the current
subfont).</TD>
</TR>
<TR>
<TD><CODE>cidfontname</CODE></TD>
<TD COLSPAN=2>Font name of the cid-keyed font as a whole (ie. not the current
subfont).</TD>
</TR>
<TR>
<TD><CODE>cidfullname</CODE></TD>
<TD COLSPAN=2>Full name of the cid-keyed font as a whole (ie. not the current
subfont).</TD>
</TR>
<TR>
<TD><CODE>cidordering</CODE></TD>
<TD COLSPAN=2> </TD>
</TR>
<TR>
<TD><CODE>cidregistry</CODE></TD>
<TD COLSPAN=2> </TD>
</TR>
<TR>
<TD><CODE>cidsubfont</CODE></TD>
<TD COLSPAN=2>Returns the number index of the current subfont in the cid-keyed
font (or -1 if this is not a cid-keyed font).
<P>
May be set to an index (an integer) or a subfont fontname (a string) to change
the current subfont. (To find the name of the current subfont, simply use
.fontname).</TD>
</TR>
<TR>
<TD><CODE>cidsubfontcnt</CODE></TD>
<TD COLSPAN=2>Returns the number of subfonts in this cid-keyed font (or 0
if it is not a cid-keyed font)</TD>
</TR>
<TR>
<TD><CODE>cidsubfontnames</CODE></TD>
<TD COLSPAN=2>Returns a tuple of the subfont names in this cid-keyed font
(or None if it is not a cid-keyed font)</TD>
</TR>
<TR>
<TD><CODE>cidsupplement</CODE></TD>
<TD COLSPAN=2> </TD>
</TR>
<TR>
<TD><CODE>cidversion</CODE></TD>
<TD COLSPAN=2> </TD>
</TR>
<TR>
<TD><CODE>cidweight</CODE></TD>
<TD COLSPAN=2>Weight of the cid-keyed font as a whole</TD>
</TR>
<TR>
<TD><CODE>comment</CODE></TD>
<TD colspan=2>A comment associated with the font. Can be anything.</TD>
</TR>
<TR>
<TD><CODE>copyright</CODE></TD>
<TD colspan=2>PostScript copyright notice</TD>
</TR>
<TR>
<TD><CODE>cvt</CODE></TD>
<TD colspan=2>Returns a sequence object containing the font's cvt table.
Changes made to this object will be made to the font (this is a reference
not a copy).<BR>
The object has one additional method cvt.find(value[,low,high]) which finds
the index of value in the cvt table (or -1 if not found). If low and high
are specified then the index will be between [low,high).</TD>
</TR>
<TR>
<TD><CODE>default_base_filename</CODE></TD>
<TD colspan=2>The default base for the filename when generating a font</TD>
</TR>
<TR>
<TD><CODE>descent</CODE></TD>
<TD colspan=2>The font's descent</TD>
</TR>
<TR>
<TD><CODE>design_size</CODE></TD>
<TD colspan=2>Size (in pica points) for which this font was designed.</TD>
</TR>
<TR>
<TD><CODE>em</CODE></TD>
<TD colspan=2>The em size of the font. Setting this will scale the entire
font to the new size.</TD>
</TR>
<TR>
<TD><CODE>encoding</CODE></TD>
<TD colspan=2>The name of the current encoding. Setting it will change the
encoding used for indexing</TD>
</TR>
<TR>
<TD><CODE>familyname</CODE></TD>
<TD colspan=2>PostScript font family name</TD>
</TR>
<TR>
<TD><CODE>fondname</CODE></TD>
<TD colspan=2>Mac fond name</TD>
</TR>
<TR>
<TD><CODE>fontlog</CODE></TD>
<TD colspan=2>A comment associated with the font. Can be anything.</TD>
</TR>
<TR>
<TD><CODE>fontname</CODE></TD>
<TD colspan=2>PostScript font name<BR>
Note that in a CID keyed font this will be the name of the current subfont.
Use cidfontname for the name of the font as a whole.</TD>
</TR>
<TR>
<TD><CODE>fullname</CODE></TD>
<TD colspan=2>PostScript font name</TD>
</TR>
<TR>
<TD><CODE>gasp</CODE></TD>
<TD colspan=2>Returns a tuple of all gasp table entries. Each item in the
tuple is itself a tuple composed of a ppem (an integer) and a tuple of flags.
The flags are a chosen from:
<UL>
<LI>
gridfit
<LI>
antialias
<LI>
symmetric-smoothing
<LI>
gridfit+smoothing
</UL>
</TD>
</TR>
<TR>
<TD><CODE>gasp_version</CODE></TD>
<TD colspan=2>The version of the 'gasp' table. Currently this may be 0 or
1.</TD>
</TR>
<TR>
<TD><CODE>gpos_lookups</CODE></TD>
<TD colspan=2>Returns a tuple of all positioning lookup names in the font.
This member cannot be set.</TD>
</TR>
<TR>
<TD><CODE>gsub_lookups</CODE></TD>
<TD colspan=2>Returns a tuple of all substitution lookup names in the font.
This member cannot be set.</TD>
</TR>
<TR>
<TD><CODE>guide</CODE></TD>
<TD colspan=2>A copy of the font's guide layer</TD>
</TR>
<TR>
<TD><CODE>hasvmetrics</CODE></TD>
</TR>
<TR>
<TD><CODE>head_optimized_for_cleartype</CODE></TD>
</TR>
<TR>
<TD><CODE>hhea_ascent</CODE></TD>
</TR>
<TR>
<TD><CODE>hhea_ascent_add</CODE></TD>
</TR>
<TR>
<TD><CODE>hhea_descent</CODE></TD>
</TR>
<TR>
<TD><CODE>hhea_descent_add</CODE></TD>
</TR>
<TR>
<TD><CODE>hhea_linegap</CODE></TD>
</TR>
<TR>
<TD><CODE><A NAME="horizontal-baseline">horizontalBaseline</A></CODE></TD>
<TD COLSPAN=2>Returns a tuple of tuples containing the horizontal baseline
information in the font (the 'BASE' table). If there is no information NONE
will be returned, otherwise the format of the tuple is:<BR>
<CODE>((tuple of baseline tags used), (tuple of script information))</CODE>
<BR>
The <CODE>(tuple of baseline tags used)</CODE> is simply a tuple of 4 letter
strings as <CODE>("hang", "ideo", "romn")</CODE> these are standard baseline
tag names as defined in the opentype spec. The number of entries here, and
their order is important as there will be subsequent tuples (in the script
tuple) which use the same ordering.
<P>
The <CODE>(tuple of script information)</CODE> is again a tuple of <CODE>script
information</CODE> tuples.
<P>
A <CODE>script information</CODE> tuple looks like<BR>
<CODE>(script-tag,default-baseline-tag, (tuple of baseline positions), (tuple
of language extents))</CODE><BR>
If there are no baseline tags defined (an empty tuple), then the
<CODE>default-baseline-tag</CODE> and the <CODE>(tuple of baseline
positions)</CODE> will be NONE. Otherwise both tags will be 4 character strings,
and the <CODE>(tuple of baseline positions)</CODE> will be a tuple of numbers
(in the same order as the <CODE>(tuple of baseline tags used)</CODE> above)
specifying the relative positions of each baseline for this script.
<P>
A <CODE>(tuple of language extents)</CODE> is a tuple of <CODE>language
extent</CODE> tuples.
<P>
A <CODE>language extent</CODE> tuple is<BR>
<CODE>(language-tag,min-extent,max-extent, (tuple of feature
extents))</CODE><BR>
<CODE>language-tag</CODE> is a 4 letter string specifying an opentype
language,<CODE>min</CODE>/<CODE>max-extent</CODE> are numbers specifying
how far above and below the baseline characters go in this script/language.
<P>
A <CODE>(tuple of feature extents></CODE> is a tuple of <CODE>feature
extent</CODE> tuples.
<P>
A <CODE>feature extent</CODE> tuple is<BR>
<CODE>(feature-tag,min-extent,max-extent, (tuple of feature
extents))</CODE><BR>
<CODE>feature-tag</CODE> is a 4 letter string specifying an opentype (GPOS
or GSUB) feature tag,<CODE>min</CODE>/<CODE>max-extent</CODE> are numbers
specifying how far above and below the baseline characters go in this
script/language with the feature applied.
<P>
<B>Example:</B>
<BLOCKQUOTE>
<PRE>(("hang","ideo","romn"),
(("cyrl","romn",(1405,-288,0),()),
("grek","romn",(1405,-288,0),()),
("latn","romn",(1405,-288,0),
("dflt",-576,1913,
("NoAc",-576,1482))
("ENG ",-576,1482,())
)
)
)
</PRE>
</BLOCKQUOTE>
</TD>
</TR>
<TR>
<TD><CODE>is_cid</CODE></TD>
<TD colspan=2>Indicates whether the font is a cid-keyed font or not. (Read-only)</TD>
</TR>
<TR>
<TD><CODE>is_quadratic</CODE></TD>
<TD colspan=2>Deprecated. Whether the contours should be interpretted as
a set of quadratic or cubic splines. Setting this value has the side effect
of converting the entire font into the other format
<P>
Now each layer may have its own setting for this value, which should be set
on the font's <A HREF="python.html#f-layers">layers</A> object.</TD>
</TR>
<TR>
<TD><CODE>isnew</CODE></TD>
<TD colspan=2>A flag indicating that this is a new font</TD>
</TR>
<TR>
<TD><CODE>italicangle</CODE></TD>
</TR>
<TR>
<TD><CODE>macstyle</CODE></TD>
<TD COLSPAN=2><pre>
Bit 0: Bold (if set to 1);
Bit 1: Italic (if set to 1)
Bit 2: Underline (if set to 1)
Bit 3: Outline (if set to 1)
Bit 4: Shadow (if set to 1)
Bit 5: Condensed (if set to 1)
Bit 6: Extended (if set to 1)
Bits 7-15: Reserved (set to 0).
</pre>
(<a href="http://www.microsoft.com/typography/otspec/head.htm">source</a>)</TD>
</TR>
<TR>
<TD><CODE>layer_cnt</CODE></TD>
<TD COLSPAN=2>The number of layers in the font. (Read only. Can change using
<CODE>add</CODE> and <CODE>del</CODE> operations on the
<A HREF="python.html#f-layers">layers</A> array)</TD>
</TR>
<TR>
<TD><CODE><A NAME="f-layers">layers</A></CODE></TD>
<TD COLSPAN=2>Returns a dictionary like object with information on the layers
of the font -- a name and a boolean indicating whether the layer is quadratic
or not.
<P>
You may remove a layer with <CODE>del font.layers["unneeded
layer"]</CODE>;<BR>
You may add a new layer with <CODE>font.layers.add("layer-name",is_quadratic[,
is_background])</CODE>;<BR>
You may change a layer's name with <CODE>font.layers["layer"].name =
"new-name"</CODE>;<BR>
You may change the type of splines in a layer with
<CODE>font.layers["layer"].is_quadratic = True</CODE>;<BR>
You may change whether it is a background layer by
<CODE>font.layers["layer"].is_background = True</CODE>;
<P>
Note: The layers that live in the font are different from layers that live
in a glyph. These objects do not have the Layer type documented earlier.</TD>
</TR>
<TR>
<TD><CODE>loadState</CODE></TD>
<TD colspan=2>A bitmask indicating non-fatal errors found when loading the
font. (readonly)
<TABLE>
<TR>
<TD>0x01</TD>
<TD>Bad PostScript entry in 'name' table</TD>
</TR>
<TR>
<TD>0x02</TD>
<TD>Bad 'glyf' or 'loca' table</TD>
</TR>
<TR>
<TD>0x04</TD>
<TD>Bad 'CFF ' table</TD>
</TR>
<TR>
<TD>0x08</TD>
<TD>Bad 'hhea', 'hmtx', 'vhea' or 'vmtx' table</TD>
</TR>
<TR>
<TD>0x10</TD>
<TD>Bad 'cmap' table</TD>
</TR>
<TR>
<TD>0x20</TD>
<TD>Bad 'EBLC', 'bloc', 'EBDT' or 'bdat' (embedded bitmap) table</TD>
</TR>
<TR>
<TD>0x40</TD>
<TD>Bad Apple GX advanced typography table</TD>
</TR>
<TR>
<TD>0x80</TD>
<TD>Bad OpenType advanced typography table (GPOS, GSUB, GDEF, BASE)</TD>
</TR>
<TR>
<TD>0x100</TD>
<TD>Bad OS/2 version number<BR>
Windows will reject all fonts with a OS/2 version number of 0 and will reject
OT-CFF fonts with a version number of 1</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE>maxp_FDEFs</CODE></TD>
<TD colspan=2>The number of function definitions used by the tt program</TD>
</TR>
<TR>
<TD><CODE>maxp_IDEFs</CODE></TD>
<TD colspan=2>The number of instruction definitions used by the tt program</TD>
</TR>
<TR>
<TD><CODE>maxp_maxStackDepth</CODE></TD>
<TD colspan=2>The maximum stack depth used by the tt program</TD>
</TR>
<TR>
<TD><CODE>maxp_storageCnt</CODE></TD>
<TD colspan=2>The number of storage locations used by the tt program</TD>
</TR>
<TR>
<TD><CODE>maxp_twilightPtCnt</CODE></TD>
<TD colspan=2>The number of points in the twilight zone of the tt program</TD>
</TR>
<TR>
<TD><CODE>maxp_zones</CODE></TD>
<TD colspan=2>The number of zones used in the tt program</TD>
</TR>
<TR>
<TD><CODE>multilayer</CODE></TD>
</TR>
<TR>
<TD><CODE>onlybitmaps</CODE></TD>
<TD colspan=2>A flag indicating that this font only contains bitmaps. No
outlines.</TD>
</TR>
<TR>
<TD><CODE>os2_codepages</CODE></TD>
<TD COLSPAN=2>A 2 element tuple containing the OS/2 Codepages field</TD>
</TR>
<TR>
<TD><CODE>os2_family_class</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_fstype</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_panose</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_strikeypos</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_strikeysize</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_subxoff</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_subxsize</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_subyoff</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_subysize</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_supxoff</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_supxsize</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_supyoff</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_supysize</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_typoascent</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_typoascent_add</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_typodescent</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_typodescent_add</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_typolinegap</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_use_typo_metrics</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_unicoderanges</CODE></TD>
<TD COLSPAN=2>A 4 element tuple containing the OS/2 Unicode Ranges field</TD>
</TR>
<TR>
<TD><CODE>os2_vendor</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_version</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_weight</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_weight_width_slope_only</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_width</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_winascent</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_winascent_add</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_windescent</CODE></TD>
</TR>
<TR>
<TD><CODE>os2_windescent_add</CODE></TD>
</TR>
<TR>
<TD><CODE><A NAME="path">path</A></CODE></TD>
<TD colspan=2>(readonly) Returns a string containing the name of the file
from which the font was originally read (in this session), or if this is
a new font, returns a made up filename in the current directory named something
like "Untitled1.sfd". See also <A HREF="#sfd-path">sfd_path</A>.</TD>
</TR>
<TR>
<TD><CODE><A NAME="font-persistent">persistent</A></CODE></TD>
<TD colspan=2>Whatever you want -- though I recommend you store a dict here
(these data will be saved as a pickled object in the sfd file. It is your
job to insure that whatever you put here can be pickled)
<P>
If you do store a dict then the following entries will be treated specially:
<TABLE border=1>
<TR>
<TD>initScriptString</TD>
<TD>If present, and if this is a string, then each time the font is loaded
from an sfd file, this string will be passed to the python interpretter.
Note: This is a string, not a function. Function code cannot be pickled.
Since it is a string it will receive no arguments, but the current font will
be available in the activeFont method of the fontforge module.
<P>
This string will be interpretted before the loadFontHook of the
<A HREF="python.html#module-hooks">module hooks</A> dictionary.
<P>
One possible behavior for this string is to define function hooks to be stored
in the temporary dict described below.</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE>math</CODE></TD>
<TD colspan=2>Returns an <A HREF="#math">object which provides information
on the font's underlying math constant table. There is only one of these
per font.</A></TD>
</TR>
<TR>
<TD><CODE>private</CODE></TD>
<TD colspan=2>Returns a <A HREF="#private">dictionary like object representing
the PostScript private dictionary</A> for the font. Changing entries in this
object will change them in the font. (It's a reference, not a copy).
<P>
There is an iterator associated with this entry.</TD>
</TR>
<TR>
<TD><CODE><A NAME="Font_privateState">privateState</A></CODE></TD>
<TD colspan=2>Checks the (PostScript) Private dictionary and returns a bitmask
of some common errors.
<TABLE>
<TR>
<TD>0x000001</TD>
<TD>Odd number of elements in either the BlueValues or OtherBlues array.</TD>
</TR>
<TR>
<TD>0x000002</TD>
<TD>Elements in either the BlueValues or OtherBlues are disordered.</TD>
</TR>
<TR>
<TD>0x000004</TD>
<TD>Too many elements in either the BlueValues or OtherBlues array.</TD>
</TR>
<TR>
<TD>0x000008</TD>
<TD>Elements in either the BlueValues or OtherBlues array are too close (must
be at least 2*BlueFuzz +1 appart.</TD>
</TR>
<TR>
<TD>0x000010</TD>
<TD>Elements in either the BlueValues or OtherBlues array are not integers.</TD>
</TR>
<TR>
<TD>0x000020</TD>
<TD>Alignment zone height in either the BlueValues or OtherBlues array is
too big for the value of BlueScale.</TD>
</TR>
<TR>
<TD>0x000100</TD>
<TD>Odd number of elements in either the FamilyBlues or FamilyOtherBlues
array.</TD>
</TR>
<TR>
<TD>0x000200</TD>
<TD>Elements in either the FamilyBlues or FamilyOtherBlues are disordered.</TD>
</TR>
<TR>
<TD>0x000400</TD>
<TD>Too many elements in either the FamilyBlues or FamilyOtherBlues array.</TD>
</TR>
<TR>
<TD>0x000800</TD>
<TD>Elements in either the FamilyBlues or FamilyOtherBlues array are too
close (must be at least 2*BlueFuzz +1 appart.</TD>
</TR>
<TR>
<TD>0x001000</TD>
<TD>Elements in either the FamilyBlues or FamilyOtherBlues array are not
integers.</TD>
</TR>
<TR>
<TD>0x002000</TD>
<TD>Alignment zone height in either the FamilyBlues or FamilyOtherBlues array
is too big for the value of BlueScale.</TD>
</TR>
<TR>
<TD>0x010000</TD>
<TD>Missing BlueValues entry.</TD>
</TR>
<TR>
<TD>0x020000</TD>
<TD>Bad BlueFuzz entry.</TD>
</TR>
<TR>
<TD>0x040000</TD>
<TD>Bad BlueScale entry.</TD>
</TR>
<TR>
<TD>0x080000</TD>
<TD>Bad StdHW entry.</TD>
</TR>
<TR>
<TD>0x100000</TD>
<TD>Bad StdVW entry.</TD>
</TR>
<TR>
<TD>0x200000</TD>
<TD>Bad StemSnapH entry.</TD>
</TR>
<TR>
<TD>0x400000</TD>
<TD>Bad StemSnapV entry.</TD>
</TR>
<TR>
<TD>0x800000</TD>
<TD>StemSnapH does not include StdHW.</TD>
</TR>
<TR>
<TD>0x1000000</TD>
<TD>StemSnapV does not include StdVW.</TD>
</TR>
<TR>
<TD>0x2000000</TD>
<TD>Bad BlueShift entry.</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE>selection</CODE></TD>
<TD colspan=2>Returns a reference to an <A href="#selection">array-like object
representing the font's selection</A>. There is one entry for each encoding
slot (there may not be a glyph attached to every encoding slot). You may
set this with a tuple of integers (or boolean values). There should not be
more entries in the tuple than there are encoding slots in the current encoding.
A <CODE>True</CODE> or non-0 value means the slot is selected.</TD>
</TR>
<TR>
<TD><CODE><A NAME="sfd-path">sfd_path</A></CODE></TD>
<TD colspan=2>(readonly) Returns a string (or None) containing the name of
the sfd file associated with this font. Sometimes this will be the same as
<A HREF="#path">path</A> (above).</TD>
</TR>
<TR>
<TD><CODE>sfnt_names</CODE></TD>
<TD colspan=2>The strings in the sfnt 'name' table. A tuple of all ms names.
Each name is itself a tuple of strings (language,strid,string). Language
may be either the (english) name of the language/locale, or the number
representing that language in MicroSoft's specification. Strid may be one
of the (english) string names (Copyright, Family, SubFamily, etc.) or the
numeric value of that item. The string itself is in UTF-8.
<P>
Mac names will be automagically created from ms names</TD>
</TR>
<TR>
<TD><CODE>sfntRevision</CODE></TD>
<TD colspan=2>The font revision field stored in the 'head' table of an sfnt.
This is documented to be a fixed 16.16 number (that is a 32 bit number with
the binary point between bits 15 and 16).
<P>
The field may be unset (in which case when the font is generated, FontForge
will guess a default value from one of the version strings).
<P>
The value returned with be <CODE>None</CODE> if the field is unset or a double.
<P>
You may set it to <CODE>None</CODE> which "unsets" it, or to a double value,
or to an integer. The integer will be treated as a 32 bit integer and right
shifted by 16 to get a 16.16 value).</TD>
</TR>
<TR>
<TD><CODE>size_feature</CODE></TD>
<TD colspan=2>The OpenType 'size' feature has two formats. It may either
represent the design size of the font (and nothing else) or the design size,
and range (top and bottom point sizes for which this design works), a style
id (used to represent this design size throughout the font family) and a
set of language/string pairs used to represent this design size in the menu.
<P>
If no size information is specified in the font FontForge will return None.
<P>
If only the design size is specified, FontForge will return a tuple containing
a single element: the point size for which the font was designed. (This is
returned as a real number -- the field can represent tenths of a point).
<P>
Otherwise FontForge returns a tuple containing five elements, the design
size, the bottom of the design range, the top, the style id and a tuple of
tuples. Each sub-tuple is a language/string pair. Language may be either
the (english) name of the language/locale, or The string itself is in UTF-8.</TD>
</TR>
<TR>
<TD><CODE>strokedfont</CODE></TD>
<TD colspan=2>is this a stroked font?</TD>
</TR>
<TR>
<TD><CODE>strokewidth</CODE></TD>
<TD colspan=2>the stroke width of a stroked font</TD>
</TR>
<TR>
<TD><CODE><A NAME="font-temporary">temporary</A></CODE></TD>
<TD colspan=2>Whatever you want -- though I recommend you store a dict here
(these data will be lost once the font is closed)
<P>
If you do store a dict then the following entries will be treated specially:
<TABLE border=1>
<TR>
<TD>generateFontPreHook</TD>
<TD>If present, and if this is a function it will be called just before a
font is generated. It will be called with the font and the filename to which
the font will be written.</TD>
</TR>
<TR>
<TD>generateFontPostHook</TD>
<TD>If present, and if this is a function it will be called just after a
font is generated. It will be called with the font and the filename to which
the font will be written.</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE>texparameters</CODE></TD>
<TD colspan=2>Returns a tuple of <A HREF="fontinfo.html#TeX">TeX font
parameters</A>. TeX font type followed by 22 parameters. Font type is one
of:
<UL>
<LI>
text
<LI>
mathsym
<LI>
mathext
<LI>
unset
</UL>
<P>
In case of "unset" default values for font parameters will be returned.</TD>
</TR>
<TR>
<TD><CODE>uniqueid</CODE></TD>
</TR>
<TR>
<TD><CODE>upos</CODE></TD>
<TD colspan=2>underline position</TD>
</TR>
<TR>
<TD><CODE>userdata</CODE></TD>
<TD colspan=2>Deprecated name for
<A HREF="python.html#font-temporary">temporary</A> above</TD>
</TR>
<TR>
<TD><CODE>uwidth</CODE></TD>
<TD colspan=2>underline width</TD>
</TR>
<TR>
<TD><CODE>version</CODE></TD>
<TD colspan=2>PostScript font version string</TD>
</TR>
<TR>
<TD><CODE>verticalBaseline</CODE></TD>
<TD COLSPAN=2>Same format as
<A HREF="#horizontal-baseline">horizontal_baseline</A>, which see.</TD>
</TR>
<TR>
<TD><CODE>vertical_origin</CODE></TD>
<TD COLSPAN=2>deprecated</TD>
</TR>
<TR>
<TD><CODE>vhea_linegap</CODE></TD>
</TR>
<TR>
<TD><CODE>weight</CODE></TD>
<TD colspan=2>PostScript font weight string</TD>
</TR>
<TR>
<TD><CODE>woffMajor</CODE></TD>
<TD colspan=2>The major version number of a woff file, an integer.
<P>
The field may be unset (in which case when the font is generated, FontForge
will guess a default value from one of the version strings).
<P>
The value returned with be <CODE>None</CODE> if the field is unset or an
integer.
<P>
You may set it to <CODE>None</CODE> which "unsets" it, or to an integer.</TD>
</TR>
<TR>
<TD><CODE>woffMinor</CODE></TD>
<TD colspan=2>The minor version number of a woff file, an integer.
<P>
The field may be unset (in which case when the font is generated, FontForge
will guess a default value from one of the version strings).
<P>
The value returned with be <CODE>None</CODE> if the field is unset or an
integer.
<P>
You may set it to <CODE>None</CODE> which "unsets" it, or to an integer.</TD>
</TR>
<TR>
<TD><CODE>woffMetadata</CODE></TD>
<TD colspan=2>Any metadata associated with a woff file. This is a utf8 string
containing unparsed xml.</TD>
</TR>
<TR>
<TD><CODE>xHeight</CODE></TD>
<TD colspan=2>(readonly) Computes the X Height (the height of lower case
letters such as "x"). A negative number indicates the value could not be
computed (the font might have no lower case letters because it was upper
case only, or didn't include glyphs for a script with lower case letters).</TD>
</TR>
<TR>
<TH colspan=3>Iterator Protocol</TH>
</TR>
<TR>
<TD><CODE>__iter__</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Returns an iterator for the font which will run through the font, in
gid order, returning glyph names</TD>
</TR>
<TR>
<TD colspan=2><CODE><name> in f</CODE></TD>
<TD>Returns whether the font contains a glyph with the given name.</TD>
</TR>
<TR>
<TD colspan="2">Other iterators over the font:</TD>
<TD><A HREF="python.html#selection">selection</A>,
font.<A HREF="python.html#font-find">find</A>(),
font.<A HREF="python.html#font-glyphs">glyphs</A>()</TD>
</TR>
<TR>
<TH colspan=3>Mapping Protocol</TH>
</TR>
<TR>
<TD colspan=2><CODE>len(f)</CODE></TD>
<TD>The number of glyph slots in the current encoding</TD>
</TR>
<TR>
<TD colspan=2><CODE>f[i]</CODE></TD>
<TD>If <EM>i</EM> is an integer, then returns the glyph at that encoding.
If a string then returns the glyph with that name. May not be assigned to.</TD>
</TR>
<TR>
<TH colspan=3>Methods</TH>
</TR>
<TR>
<TH>method</TH>
<TH>args</TH>
<TH>comments</TH>
</TR>
<TR>
<TD><CODE>addAnchorClass</CODE></TD>
<TD><CODE>(lookup-subtable-name,<BR>
new-anchor-class-name)</CODE></TD>
<TD>Adds an anchor class to the specified (anchor) subtable.</TD>
</TR>
<TR>
<TD><a name="addKerningClass"><CODE>addKerningClass</CODE></a></TD>
<TD><CODE>(lookup-name,new-subtable-name,<BR>
first-classes,<BR>
second-classes,<BR>
offsets<BR>
[,after])</CODE>
<P ALIGN=Center>
<STRONG>or</STRONG>
<P>
<CODE>(lookup-name,new-subtable-name,<BR>
separation,<BR>
first-classes,<BR>
second-classes<BR>
[,onlyCloser,autokern,after])</CODE>
<P ALIGN=Center>
<STRONG>or</STRONG>
<P>
<CODE>(lookup-name,new-subtable-name,<BR>
separation,class-distance,<BR>
,first-glyph-list,<BR>
second-glyph-list,<BR>
[,onlyCloser,autokern,after])</CODE>
<P ALIGN=Center>
<STRONG>or</STRONG>
<P>
<CODE>(lookup-name,new-subtable-name,<BR>
separation,class-distance,<BR>
[,onlyCloser,autokern,after])</CODE></TD>
<TD>Creates a new subtable and a new kerning class in the named lookup. The
classes arguments are tuples of tuples of glyph names (each sub-tuble of
glyph names is a kerning class). The offsets argument is a tuple of kerning
offsets. There must be as many entries as
<CODE>len(first-class)*len(second-class)</CODE>. The optional after argument
is used to specify the order of the subtable within the lookup.
<P>
The second format will cause FontForge to auto kern the subtable. The separation
argument specifies the desired optical distance between any two glyphs (if
this is specified as 0 then the kerning class will be designed so glyphs
just touch each other). Again the user specifies two sets of predefined classes.
If the (optional) <CODE>onlyCloser</CODE> flag is set true then only negative
kerning values will be inserted into the table.
<P>
In the third format the user merely specifies two lists of glyphs to be used,
fontforge will look for similarities among among the glyphs and guess at
classes. The class-distance argument to determine how precise the classes
should match (1 is very tight matching, 20 is rather loose).
<P>
In the last format the font's selection will be used to specify the list
of glyphs to be examined (and the same list will be used for both the left
and right glyphs -- but fontforge will probably find different classes).</TD>
</TR>
<TR>
<TD><CODE><A name="font-addLookup">addLookup</A></CODE></TD>
<TD><CODE>(new-lookup-name,type,flags,<BR>
feature-script-lang-tuple<BR>
[,after-lookup-name)</CODE></TD>
<TD>Creates a new lookup with the given name, type and flags. It will tag
it with any indicated features. The type of one of
<UL>
<LI>
gsub_single
<LI>
gsub_multiple
<LI>
gsub_alternate
<LI>
gsub_ligature
<LI>
gsub_context
<LI>
gsub_contextchain
<LI>
gsub_revesechain
<LI>
morx_indic
<LI>
morx_context
<LI>
morx_insert
<LI>
gpos_single
<LI>
gpos_pair
<LI>
gpos_cursive
<LI>
gpos_mark2base
<LI>
gpos_mark2ligature
<LI>
gpos_mark2mark
<LI>
gpos_context
<LI>
gpos_contextchain
<LI>
kern_statemachine
</UL>
<P>
The flags argument is a tuple of strings. At most one of these strings may
be the name of a mark class. The others are:
<UL>
<LI>
right_to_left
<LI>
ignore_bases
<LI>
ignore_ligatures
<LI>
ignore_marks
</UL>
<P>
A feature-script-lang tuple is a tuple with one entry for each feature (there
may be no entries if there are no features). Each entry is itself a two element
tuple, the first entry is a string containing a 4 letter feature tag, and
the second entry is another tuple (potentially empty) with an entry for each
script for which the feature is active. Each entry here is itself a two element
tuple. The first element is a 4 letter script tag and the second is a tuple
of languages. Each entry in the language tuple is a four letter language.
Example: (("liga",(("latn",("dflt")),)),)<BR>
The optional final argument allows you to specify the ordering of the lookup.
If not specified the lookup will be come the first lookup in its table.</TD>
</TR>
<TR>
<TD><CODE>addLookupSubtable</CODE></TD>
<TD><CODE>(lookup-name,<BR>
new-subtable-name<BR>
[,after-subtable-name])</CODE></TD>
<TD>Creates a new subtable within the specified lookup.
The lookup name should be a string specifying an existing lookup.
The subtable name should also be a string and should not match
any currently existing subtable in the lookup.
The optional final
argument allows you to specify the ordering within the lookup. If not specified
this subtable will be first in the lookup.
<P>
If you want to create a subtable in a contextual lookup, then use
<a href="#addContextualSubtable"><CODE>addContextualSubtable</CODE></a> below.
If you want to create a kerning class subtable, then use
<a href="#addKerningClass"><CODE>addKerningClass</CODE></a> above.
</TD>
</TR>
<TR>
<TD><a name="addContextualSubtable"><CODE>addContextualSubtable</CODE></a></TD>
<TD><CODE>(lookup-name,<BR>
new-subtable-name<BR>
type<BR>
rule<BR>
[,afterSubtable=]
[,bclasses=]
[,mclasses=]
[,fclasses=]
[,bclassnames=]
[,mclassnames=]
[,fclassnames=] )</CODE></TD>
<TD>Creates a new subtable within the specified contextual lookup
(contextual, contextual chaining, or reverse contextual chaining).
The lookup name should be a string specifying an existing lookup.
The subtable name should also be a string and should not match
any currently existing subtable in the lookup.
<P>The <CODE>type</CODE> should be one of the strings "glyph", "class",
"coverage" or "reversecoverage".
The <CODE>rule</CODE> should be a string specifying a string to match
and a set of lookups to apply once the match has been made. (See below
for more details).
<P>The remaining arguments are optional, keyword arguments.
<UL><LI><CODE>afterSubtable=</CODE>, if present this should be followed by
a string, the name of a subtable after which this one is to be placed
in the lookup. If not specified this subtable will be first in the
lookup.
<LI><CODE>bclasses=, fclasses=, mclasses=</CODE> these three arguments
specify sets of glyph classes for when <CODE>type="class"</CODE>. They
should be a tuple of thingies where each thingy is either a string
containing a list of space separated glyph names, or another tuple
containing a set of strings, each a glyph name. Note that the first
class is magic and should usually be left as a null string.
<LI><CODE>bclassnames=, fclassnames=, mclassnames=</CODE> These provide
names for the glyph classes described above. These names are optional,
but can be convenient. These are tuples of strings. There should be the
same number of entries in <CODE>bclassnames</CODE> as there are in
<CODE>bclasses</code>.
</UL>
<DL>
<DT>
When <CODE>type="glyph"</CODE>
<DD>The rule should look something like:<BR/>
<CODE> glyph-name1 glyph-name2 | glyph-name3 @<lookup-name> | glyph-name4</CODE><BR/>
The "|"s divide between backtrack, match and lookahead sections. So this
example would match it the current glyph were named <CODE>glyph-name3</CODE>
and it were preceded by <CODE>glyph-name2</CODE> and that by
<CODE>glyph-name1</CODE> and followed by <CODE>glyph-name4</CODE>. If
the match were successful then the lookup named <CODE>lookup-name</CODE>
would be applied. The @<> are litteral characters and should be
present in the rule.
<P>If the invoked lookup is a ligature lookup then it should be invoked
after the first glyph that forms the lookup (rather than the last) and
all glyphs that might make up the lookup should be in the match section.
So...<BR/>
<CODE> e | f @<ff-lig> f l | o</CODE><BR/>
would only apply the <CODE>ff-lig</CODE> lookup if the <CODE>ffl</CODE>
were preceeded by <CODE>e</CODE> and followed by <CODE>o</CODE>.
<DT>
When <CODE>type="class"</CODE>
<DD>The rule should look something like:<BR/>
<CODE> class-name1 class-name2 | class-name3 @<lookup-name> | class-name4</CODE><BR/>
Very similar to the case of glyphs, except that instead of glyph names
we have class names here. It is possible to have different sets of
class names in the three different sections (backtrack, match and
lookahead). If you don't specify any class names then you must use
numbers instead, each number refering to the class at that position in
the tuple (the first class will be class 0, the second class 1, and so
on).
<DT>
When <CODE>type="coverage"</CODE>
<DD>The rule should look something like:<BR/>
<CODE> [g1 g2] [g3 g4] | [g5 g6 g7] @<lookup-name> | [g8 g9]</CODE><BR/>
Each entry within brackets, <CODE>[]</CODE>, represents a coverage table
and should be a list of glyph names. The brackets are specified literally.
<DT>
When <CODE>type="reversecoverage"</CODE>
<DD>The rule should look something like:<BR/>
<CODE> [g1 g2] [g3 g4] | [g5 g6 g7] => [rg1 rg2 rg3] | [g8 g9]</CODE><BR/>
Very similar to normal coverage tables except that instead of specifying
a lookup there are replacement glyphs inline. There must be the same
number of replacement glyphs (<CODE>rg1, rg2, rg3</CODE>) as match
glyphs (<CODE>g5, g6, g7</CODE>) and there may be only one coverage
table in the match section.
</DL>
<STRONG>WARNING</STRONG> This format has some limitations, if there are
multiple lookups they will be applied in textual order (First lookup
in the string is the first one applied). This limitation is also
present in Adobe's feature files so I hope it shan't be a severe
limitation.
</TD>
</TR>
<TR>
<TD><CODE>addSmallCaps</CODE></TD>
<TD><CODE>(scheight=,<BR>
capheight=,<BR>
lcstem=,<BR>
ucstem=,<BR>
symbols=,<BR>
letter_extension=,<BR>
symbol_extension=,<BR>
stem_height_factor=)</CODE></TD>
<TD>This function uses keyword parameters. None is required, if omitted a
default value will be used (generally found by analyzing the font).
<P>
For each selected letter, this function will create a corresponding small
caps glyph. If you set the <CODE>symbol</CODE> keyword to <CODE>true</CODE>
it will also create small caps variants of digits and symbols.
<P>
The outlines of the new glyph will be based on the outlines of the upper-case
variant of the letter. These will then <B></B>be scaled so that a glyph which
was <CODE>capheight</CODE> high will now be <CODE>scheight</CODE> high, and
so that stems which were <CODE>ucstem</CODE> wide will be <CODE>lcstem</CODE>
wide. Normally the ratio of stem heights is the same as the ratio of stem
widths, but you may change that with <CODE>stem_height_factor</CODE>.
<P>
When it creates a new glyph it will name that glyph by appending ".sc" to
the original lower case letter name (so "a" would become "a.sc") you may
change the extension used with <CODE>letter_extension</CODE>. Similary symbols
and digits will use the extension "taboldstyle", but you may change that
with <CODE>symbol_extension</CODE>.
<P>
When it creates a glyph it also creates two lookups one bound to the feature
"c2sc" and the other to "smcp". A mapping from the lower case letter to the
small caps letter will be provided under "smcp", while a mapping from the
upper case to the small caps under "c2sc". Symbols will have both lookup
maps attached to the original glyph.</TD>
</TR>
<TR>
<TD><CODE>alterKerningClass</CODE></TD>
<TD><CODE>(subtable-name,<BR>
first-classes,<BR>
second-classes,<BR>
offsets)</CODE></TD>
<TD>Changes the kerning class in the named subtable. The classes arguments
are tuples of tuples of glyph names (each sub-tuble of glyph names is a kerning
class). The offsets argument is a tuple of kerning offsets. There must be
as many entries as <CODE>len(first-class)*len(second-class)</CODE>. The optional
after argument is used to specify the order of the subtable within the lookup.</TD>
</TR>
<TR>
<TD><CODE>autoKern</CODE></TD>
<TD><CODE>(subtable-name,<BR>
separation<BR>
[,minKern=,<BR>
onlyCloser=,<BR>
touch=])</CODE>
<P align="center">
<STRONG>or</STRONG>
<P>
<CODE>(subtable-name,<BR>
separation,<BR>
glyph-list1,<BR>
glyph-list2<BR>
[,minKern=,<BR>
onlyCloser=,<BR>
touch=])</CODE></TD>
<TD>The named subtable must be a kerning pair subtable that already exists.
<P>
This command will automatically generate kerning pairs for the named subtable.
If no glyph lists are specified it will look at all pairs of the glyphs in
the selection; if glyph lists are specified then it will look at all pairs
that can be made with one glyph from the first list and the second from the
second list.
<P>
It will attempt to guess a good kerning value between the two glyphs -- a
value which will make the optical separation between the two appear to be
<CODE>separation</CODE> em-units. If <CODE>minkern</CODE> is specified then
and the (absolute value of the) kerning correction is less than this number
then no kerning pair will be generated. If <CODE>onlyCloser</CODE> is set
true then only negative kerning offsets will be generated (only thing which
move two glyphs closer together). If touch is set to 1 then the kerning offset
will not be based on optical distance but on the closest approach between
two the two glyphs.</TD>
</TR>
<TR>
<TD><CODE>appendSFNTName</CODE></TD>
<TD><CODE>(language,strid,string)</CODE></TD>
<TD>Adds a new (or replaces an old) string in the sfnt 'name' table. Language
may be either the english name of the language/locale as a string, or the
number representing that language in MicroSoft's specification. Strid may
be one of the (english) string names (Copyright, Family, SubFamily, etc.)
or the numeric value of that item. The string itself is in UTF-8.</TD>
</TR>
<TR>
<TD><CODE>buildOrReplaceAALTFeatures</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes any existing AALT features (and any lookups solely controled
by such features) and creates new ones containing all possible single and
alternate substutions available for each glyph.</TD>
</TR>
<TR>
<TD><CODE>cidConvertByCMap</CODE></TD>
<TD><CODE>(cmap-filename)</CODE></TD>
<TD>Converts a normal font into a CID-keyed font with one subfont using
<P>
the CMAP to determine the mapping.</TD>
</TR>
<TR>
<TD><CODE>cidConvertTo</CODE></TD>
<TD><CODE>(registry,ordering,supplement)</CODE></TD>
<TD>Converts a normal font into a CID-keyed font with one subfont.</TD>
</TR>
<TR>
<TD><CODE>cidFlatten</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Converts a CID font into a normal font (glyphs will be in CID order).</TD>
</TR>
<TR>
<TD><CODE>cidFlattenByCMap</CODE></TD>
<TD><CODE>(cmap-filename)</CODE></TD>
<TD>Converts a CID font into a normal font using the encoding specified in
the CMAP file.</TD>
</TR>
<TR>
<TD><CODE>cidInsertBlankSubFont</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Adds a new (blank) sub-font into a cid-keyed font and changes the current
sub-font to be it.</TD>
</TR>
<TR>
<TD><CODE>cidRemoveSubFont</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes the current subfont from a cid-keyed font.</TD>
</TR>
<TR>
<TD><CODE>close</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Frees memory for the current font.
<P>
<STRONG>Warning:</STRONG> Any python pointers to it will become invalid.</TD>
</TR>
<TR>
<TD><CODE>compareFonts</CODE></TD>
<TD><CODE>(other-font,filename,<BR>
flags-tuple)</CODE></TD>
<TD>This will compare the current font with the font in
<CODE>other-font</CODE> (which must already have been opened). It will write
the results to the <CODE>filename</CODE>, you may use "-" to send the output
to stdout. The <CODE>flags</CODE> argument is a tuple of strings and controls
what will be compared.
<TABLE BORDER CELLPADDING="2">
<CAPTION>
<SMALL>flags</SMALL>
</CAPTION>
<TR>
<TD>outlines</TD>
<TD>compare outlines</TD>
</TR>
<TR>
<TD>outlines-exactly</TD>
<TD>compare outlines exactly (otherwise allow slight errors and the unlinking
of references)</TD>
</TR>
<TR>
<TD>warn-outlines-mismatch</TD>
<TD>warn if the outlines don't exactly match (but are pretty close)</TD>
</TR>
<TR>
<TD>hints</TD>
<TD>compare hints</TD>
</TR>
<TR>
<TD>warn-refs-unlink</TD>
<TD>warn if references need to be unlinked before a match is found</TD>
</TR>
<TR>
<TD>strikes</TD>
<TD>compare bitmap strikes</TD>
</TR>
<TR>
<TD>fontnames</TD>
<TD>compare font names</TD>
</TR>
<TR>
<TD>gpos</TD>
<TD>compare glyph positioning</TD>
</TR>
<TR>
<TD>gsub</TD>
<TD>compare glyph substitutions</TD>
</TR>
<TR>
<TD>add-outlines</TD>
<TD>for any glyphs whose outlines differ, add the outlines of the glyph in
the second font to the background of the glyph in the first</TD>
</TR>
<TR>
<TD>create-glyphs</TD>
<TD>if a glyph exists in the second font but not the first, create that glyph
in the first and add the outlines from the second into the backgroun layer</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD><CODE><A name="f-createChar">createChar</A></CODE></TD>
<TD><CODE>(uni[,name])</CODE></TD>
<TD>Create (and return) a character at the specified unicode codepoint in
this font and optionally name it. If you wish to create an glyph with no
unicode codepoint set the first argument to -1 and specify a name. If there
is already a character there, return it<!-- (it will not be renamed) – this seems to be wrong -->.</TD>
</TR>
<TR>
<TD><CODE>createInterpolatedGlyph</CODE></TD>
<TD><CODE>(glyph1,glyph2,amount)</CODE></TD>
<TD>Create (and return) a glyph with the same unicode code point as glyph1.
The glyph may not already exist. The contents of the glyph will be formed
by interpolating between glyph1 and glyph2. If amount==0 the result will
look like glyph1, or 1 then like glyph2.</TD>
</TR>
<TR>
<TD><CODE>createMappedChar</CODE></TD>
<TD><CODE>(enc)<BR>
(name)</CODE></TD>
<TD>Create (and return) a character at the specified encoding in this font.
If there is already a character there, return it</TD>
</TR>
<TR>
<TD><CODE><A NAME="font-find">find</A></CODE></TD>
<TD><CODE>(contour[,error-bound,search_flags])</CODE></TD>
<TD>Searches the font for all glyphs containing the contour (or layer) and
returns an iterator which returns those glyphs.
<P>
error-bound: defaults to 0.01.<BR>
search_flags: tuple of the strings: reverse, flips, rotate, scale.
<P>
When found, the glyph.temporary is set to a dict of:
<PRE>
{
"findMatchedRefs": matched_refs_bit_map,
"findMatchedContours": matched_contours_bit_map,
"findMatchedContoursStart": matched_contours_start_bit_map,
}
</PRE>
</TD>
</TR>
<TR>
<TD><CODE>findEncodingSlot</CODE></TD>
<TD><CODE>(uni)<BR>
(name)</CODE></TD>
<TD>Tests whether a glyph with this codepoint or name is in the font's encoding
and returns the encoding slot. If the glyph is not present it returns -1.
<P>
(If a glyph with that name/unicode is in the font, but is not in the encoding,
then an value beyond the end of the encoding will be returned).</TD>
</TR>
<TR>
<TD><CODE><A NAME="font-glyphs">glyphs</A></CODE></TD>
<TD><CODE>([type])</CODE></TD>
<TD>Returns an iterator which will return the glyphs in the font. By default
they will be returned in "GID" order, but if type is specified as "encoding"
they will be returned in encoding order. If returned in encoding order it
is possible that a glyph will be returned more than once if there are multiple
encoding slots which reference it.</TD>
</TR>
<TR>
<TD><CODE><A name="f-generate">generate</A></CODE></TD>
<TD><CODE>(filename<BR>
[,bitmap_type=,<BR>
flags=,<BR>
bitmap_resolution=,<BR>
subfont_directory=,<BR>
namelist=,<BR>
layer=])</CODE></TD>
<TD>Generates a font. The type is determined by the font's extension. The
bitmap type (if specified) is also an extension. If layer is specified, then
the splines and references in that layer will be used instead of the foreground
layer.
<P>
Flags is a tuple containing some of
<DL>
<DT>
afm
<DD>
output an afm file
<DT>
pfm
<DD>
output a pfm file
<DT>
tfm
<DD>
output a tfm file
<DT>
ofm
<DD>
output a ofm file
<DT>
composites-in-afm
<DD>
Store composite info in the afm file
<DT>
glyph-map-file
<DD>
Output a glyph map file giving the mapping between output gid and glyphnames
<DT>
short-post
<DD>
Do not include glyphnames in a ttf/otf file
<DT>
apple
<DD>
output apple advanced typography tables
<DT>
opentype
<DD>
output opentype tables
<DT>
old-kern
<DD>
output an old style 'kern' with opentype tables
<DT>
dummy-dsig
<DD>
output an empty DSIG table so MS will mark a font with .ttf extension as
an OpenType font.
<DT>
TeX-table
<DD>
Include a 'TeX ' table in an ttf/otf file
<DT>
round
<DD>
Round PS coordinates to integers
<DT>
no-hints
<DD>
Do not include PS hints
<DT>
no-flex
<DD>
Do not include PS flex hints
<DT>
omit-instructions
<DD>
Do not include TrueType instructions
<DT>
PfEd-comments
<DD>
Include font and glyph comments in the 'PfEd' table
<DT>
PfEd-colors
<DD>
Include glyph colors in the 'PfEd' table
<DT>
PfEd-lookups
<DD>
Include lookup names in the 'PfEd' table
<DT>
PfEd-guidelines
<DD>
Include guideline locations in the 'PfEd' table
<DT>
PfEd-background
<DD>
Include background (and spiro) layers in the 'PfEd' table
<DT>
symbol
<DD>
Generate an sfnt with a Symbol cmap entry rather than a Unicode entry.
</DL>
<P>
See also <A href="#font-save">save()</A>.</TD>
</TR>
<TR>
<TD><CODE>generateTtc</CODE></TD>
<TD><CODE>(filename,others,<BR>
[flags=,<BR>
ttcflags=, namelist=,<BR>
layer=])</CODE></TD>
<TD>Generates a truetype collection file containing the current font and
all others listed -- the <CODE>others</CODE> argument may be
<CODE>None</CODE>, a font, or a tuple (or list) of fonts.
<P>
Flags are as above,
<P>
Ttcflags is a tuple consisting of the following
<DL>
<DT>
merge
<DD>
Try and share tables and glyphs among the various fonts.
<DT>
cff
<DD>
Use the CFF glyph format rather than the TrueType format (the OpenType
documentation says that this does not work, but both the Mac and unix/linux
accept it).
</DL>
</TD>
</TR>
<TR>
<TD><CODE>generateFeatureFile</CODE></TD>
<TD><CODE>(filename[,lookup-name])</CODE></TD>
<TD>Generates an adobe feature file for the current font. If a lookup-name
is specified then only data for that lookup will be generated.</TD>
</TR>
<TR>
<TD><CODE>genericGlyphChange</CODE></TD>
<TD><CODE>(stemType=<str>,<BR>
thickThreshold=<double>,<BR>
stemScale=<double>,<BR>
stemAdd=<double>,<BR>
stemHeightScale=<double>,<BR>
stemHeightAdd=<double>,<BR>
stemWidthScale=<double>,<BR>
stemWidthAdd=<double>,<BR>
thinStemScale=<double>,<BR>
thinStemAdd=<double>,<BR>
thickStemScale=<double>,<BR>
thickStemAdd=<double>,<BR>
processDiagonalStems=<boolean>,<BR>
<BR>
hCounterType=<str>,<BR>
hCounterScale=<double>,<BR>
hCounterAdd=<double>,<BR>
lsbScale=<double>,<BR>
lsbAdd=<double>,<BR>
rsbScale=<double>,<BR>
rsbAdd=<double>,<BR>
<BR>
vCounterType=<str>,<BR>
vCounterScale=<double>,<BR>
vCounterAdd=<double>,<BR>
vScale=<double>,<BR>
vMap=<tuple of tuples>)</CODE></TD>
<TD>This function uses keyword parameters. Which ones are required depends
on the three type arguments (<CODE>stemType, hCounterType,
vCounterType</CODE>).
<P>
If <CODE>stemType</CODE> is omitted, or is the string "uniform", then
the <CODE>stemScale</CODE> parameter must be specified (and
<CODE>stemAdd</CODE> may be). <CODE>stemScale</CODE> specifies a
scaling factor by which all stems (horizontal and vertical, thick and
thin) will be scaled. A value of 1.0 means no change. While
<CODE>stemAdd</CODE> specifies the number of em-units to add to the
width of each stem.
<P>
If <CODE>stemType</CODE> is the string "horizontalVertical",
then values must be specified for <CODE>stemHeightScale</CODE> and
<CODE>stemWidthScale</CODE> (and may be for <CODE>stemHeightAdd,
stemWidthAdd</CODE>). The first of these specifies scaling for the
height of horizontal stems, and the second scaling for the width
of vertical stems.
<P>
If <CODE>stemType</CODE> is the string "thickThin",
then values must be specified for <CODE>thinStemScale</CODE>,
<CODE>thickStemScale</CODE> and <CODE>thickThreshold</CODE>
(and may be for <CODE>thinStemAdd, thickStemAdd</CODE>). The
first of these specifies scaling for the width/height of thin
stems, and the second scaling for the width/height of thick
stems. While the <CODE>thickThreshold</CODE> argument specifies
the size (in em-units) at which a stem is classified as "thick".
<P>
<P>
If <CODE>hCounterType</CODE> is omitted, or is the string "uniform",
then horizontal counters, and the left and right side bearings will
all be scaled using the same rules, and <CODE>hCounterScale</CODE>
must be specified to provide the scaling factor (while
<CODE>hCounterAdd</CODE> may be specified).
<P>
If <CODE>hCounterType</CODE> is the string "nonUniform",
then horizontal counters, and the left and right side bearings may
all be scaled using different rules, and <CODE>hCounterScale,
lsbScale</CODE> and <CODE>rsbScale</CODE> must be specified to
provide the scaling factors (while <CODE>hCounterAdd, lsbAdd,</CODE>
and <CODE>rsbAdd</CODE> may be specified).
<P>
If <CODE>hCounterType</CODE> is the string "center", then the left
and right side-bearings will be set so the new glyph is centered
within the original glyph's width. (Probably more useful for CJK
fonts than LGC fonts).
<P>
If <CODE>hCounterType</CODE> is the string "retainScale", then the
left and right side-bearings will be set so the new glyph is within
within the original glyph's width, and the side-bearings remain in
the same proportion to each other as before.
<P>
<P>
If <CODE>vCounterType</CODE> is omitted, or is the string "mapped",
then certain zones on the glyph may be placed at new (or the same)
locations -- similar to BlueValues. So you can specify a zone for
the baseline, one for the
x-height and another for the top of capitals and ascenders (and perhaps
a fourth for descenders). Each such zone is specified by the
<CODE>vMap</CODE> argument which is a tuple of 3-tuples, each
3-tuple specifying a zone with: Original location, original width, and
final location. <strong>No default value is provided for this argument
you must figure out all the values yourself</strong>.
<P>
If <CODE>vCounterType</CODE> is the string "scaled",
then vertical counters, and the top and bottom side bearings will
all be scaled using the same rules, and <CODE>vCounterScale</CODE>
must be specified to provide the scaling factor (while
<CODE>vCounterAdd</CODE> may be specified). This is probably most
useful for CJK fonts.</TD>
</TR>
<TR>
<TD><CODE>getKerningClass</CODE></TD>
<TD><CODE>(subtable-name)</CODE></TD>
<TD>Returns a tuple whose entries are: (first-classes, second-classes, offsets).
The classes are themselves tuples of tuples of glyph names. The offsets will
be a tuple of numeric kerning offsets.</TD>
</TR>
<TR>
<TD><CODE>getLookupInfo</CODE></TD>
<TD><CODE>(lookup-name)</CODE></TD>
<TD>Returns a tuple whose entries are: (lookup-type, lookup-flags,
feature-script-lang-tuple) The lookup type is a string as described in
<A HREF="#font-addLookup">addLookup</A>, and the feature-script-lang tuple
is also described <A HREF="#font-addLookup">there</A>.</TD>
</TR>
<TR>
<TD><CODE>getLookupSubtables</CODE></TD>
<TD><CODE>(lookup-name)</CODE></TD>
<TD>Returns a tuple of all subtable names in that lookup.</TD>
</TR>
<TR>
<TD><CODE>getLookupSubtableAnchorClasses</CODE></TD>
<TD><CODE>(subtable-name)</CODE></TD>
<TD>Returns a tuple of all anchor class names in that subtable.</TD>
</TR>
<TR>
<TD><CODE>getLookupOfSubtable</CODE></TD>
<TD><CODE>(subtable-name)</CODE></TD>
<TD>Returns the name of the lookup containing this subtable.</TD>
</TR>
<TR>
<TD><CODE>getSubtableOfAnchor</CODE></TD>
<TD><CODE>(anchor-class-name)</CODE></TD>
<TD>Returns the name of the subtable containing this anchor class.</TD>
</TR>
<TR>
<TD><CODE>importBitmaps</CODE></TD>
<TD><CODE>(bitmap-font-file<BR>
[,to-background])</CODE></TD>
<TD>Load any bitmap strikes out of the bitmap-font-file into the current
font</TD>
</TR>
<TR>
<TD><CODE>importLookups</CODE></TD>
<TD><CODE>(another-font,lookup-names<BR>
[,before-name])</CODE></TD>
<TD>The first argument must be a FontForge Font object, the second a string
or a tuple of strings, and the third, another string. It will search the
other font for the named lookup(s) and import it into the current font.
(Contextual lookups which invoke other lookups will have any nested lookups
imported as well). Lookups will be imported in the order listed. If a before-name
is specified, then it is looked up in the current font and all lookups will
be added before it, if not specified lookups will appear at the end of the
list.</TD>
</TR>
<TR>
<TD><CODE>interpolateFonts</CODE></TD>
<TD><CODE>(fraction,filename)</CODE></TD>
<TD>Interpolates a font between the current font and the font contained in
filename.</TD>
</TR>
<TR>
<TD><CODE>isKerningClass</CODE></TD>
<TD><CODE>(subtable-name)</CODE></TD>
<TD>Returns whether the named subtable contains a kerning class.</TD>
</TR>
<TR>
<TD><CODE>isVerticalKerning</CODE></TD>
<TD><CODE>(subtable-name)</CODE></TD>
<TD>Returns whether the named subtable contains a vertical kerning data</TD>
</TR>
<TR>
<TD><CODE>italicize</CODE></TD>
<TD><CODE>(italic_angle=, ia=<BR>
lc_condense=, lc=<BR>
uc_condense=, uc=<BR>
symbol_condense=, symbol=<BR>
deserif_flat=,<BR>
deserif_slant=,<BR>
deserif_pen=,<BR>
baseline_serifs=,<BR>
xheight_serifs=,<BR>
ascent_serifs=,<BR>
descent_serifs=,<BR>
diagonal_serifs=,<BR>
a=,<BR>
f=,<BR>
u0438=,<BR>
u043f=,<BR>
u0442=,<BR>
u0444=,<BR>
u0448=,<BR>
u0452=,<BR>
u045f=)</CODE></TD>
<TD>This function uses keyword parameters. None is required, if omitted a
default value will be used. Some keywords have abbreviations ("ia" for
"italic_angle") you may use either.
<P>
This function will attempt to italicize each selected glyph. For a detailed
explanation of what this entails please see the information on the
<A href="Styles.html#Italic"> Italic dialog</A>.
<P>
The <CODE>*_condense</CODE> keywords should be 4 element tuples of floating
point numbers; these numbers correspond to: Left side bearing condensation,
stem condensation, counter condensation and right side bearing condensation.
These numbers should be small numbers around 1 (scale factors, not percentages).
<P>
Set at most one of the <CODE>deserif_*</CODE> keywords.
<P>
Setting <CODE>a</CODE> to <CODE>true</CODE> will turn on the transformation
that applies to the "a" glyph. Setting <CODE>u0438</CODE> will control the
transformation that applies to the glyph at unicode codepoint U+0438.
<P>
The <CODE>f</CODE> keyword is slightly more complex. Setting it to 0 turns
off all transformations of glyphs like "f", setting it to 1 will give "f"
a tail which looks like a rotated version of its head, and setting it to
2 will simply extend the main stem of "f" below the baseline.</TD>
</TR>
<TR>
<TD><CODE>lookupSetFeatureList</CODE></TD>
<TD><CODE>(lookup-name,<BR>
feature-script-lang-tuple)</CODE></TD>
<TD>Sets the feature list of indicated lookup. The feature-script-lang tuple
is described at <A HREF="#font-addLookup">addLookup</A>.</TD>
</TR>
<TR>
<TD><CODE>lookupSetFlags</CODE></TD>
<TD><CODE>(lookup-name,flags)</CODE></TD>
<TD>Sets the lookup flags for the named lookup.</TD>
</TR>
<TR>
<TD><CODE>lookupSetStoreLigatureInAfm</CODE></TD>
<TD><CODE>(lookup-name,boolean)</CODE></TD>
<TD>Sets whether this ligature lookup contains data to store in the afm.</TD>
</TR>
<TR>
<TD><CODE>mergeFonts</CODE></TD>
<TD><CODE>(filename[,<BR>
preserveCrossFontKerning])</CODE></TD>
<TD>Merges the font in the file into the current font.</TD>
</TR>
<TR>
<TD><CODE>mergeFeature</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Merge feature and lookup information from an adobe feature file, or metrics
information from the (afm,tfm,etc) file into the current font.</TD>
</TR>
<TR>
<TD><CODE>mergeKern</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Deprecated name for mergeFeature above</TD>
</TR>
<TR>
<TD><CODE>mergeLookups</CODE></TD>
<TD><CODE>(lookup-name1,lookup-name2)</CODE></TD>
<TD>The lookups must be of the same type. All subtables from lookup-name2
will be moved to lookup-name1, the features list of lookup-name2 will be
merged with that of lookup-name1, and lookup-name2 will be removed.</TD>
</TR>
<TR>
<TD><CODE>mergeLookupSubtables</CODE></TD>
<TD><CODE>(subtable-name1,<BR>
subtable-name2)</CODE></TD>
<TD>The subtables must be in the same lookup. Not all lookup types allow
their subtables to be merged (contextual subtables may not be merged, kerning
classes may not be (kerning pairs may be)). Any information bound to subtable2
will be bound to subtable1 and subtable2 will be removed.</TD>
</TR>
<TR>
<TD><CODE>printSample</CODE></TD>
<TD><CODE>(type,pointsize,<BR>
sample,output-file)</CODE></TD>
<TD>Type is a string which must be one of
<DL>
<DT>
fontdisplay
<DD>
Display all glyphs in the font in encoding order
<DT>
chars
<DD>
Display the selected glyphs scaled to fill a page<BR>
Ignores the pointsize argument.
<DT>
waterfall
<DD>
Displays the selected glyphs at many pointsizes.<BR>
The pointsize argument should be a tuple of pointsizes here.
<DT>
fontsample
<DD>
The third argument should contain a string which will be layed out and displayed
as well as FontForge can.
<DT>
fontsampleinfile
<DD>
The third argument should contain the name of a file which contains text
to be layed out and displayed.
</DL>
<P>
If output is to a file (see <A href="#printSetup">printSetup</A>) then the
last argument specifies a file name in which to store output.</TD>
</TR>
<TR>
<TD><CODE>randomText</CODE></TD>
<TD><CODE>(script[,lang])</CODE></TD>
<TD>Returns a random text sample using the letter frequencies of the specified
script (and optionally language). Both script and language should be expressed
as strings containing OpenType Script and Language tags. "dflt" is a reasonable
language tag. If the language is not specified, one will be chosen at random.
If ff has no frequency information for the script/language specified it will
use the letters in the script with equal frequencies.</TD>
</TR>
<TR>
<TD><CODE><A name="f-regenBitmaps">regenBitmaps</A></CODE></TD>
<TD><CODE>(tuple-of-sizes)</CODE></TD>
<TD>A tuple with an entry for each bitmap strike to be regenerated
(rerasterized). Each strike is identified by pixelsize (if the strike is
a grey scale font it will be indicated by
<CODE>(bitmap-depth<<16)|pixelsize</CODE>.</TD>
</TR>
<TR>
<TD><CODE>removeAnchorClass</CODE></TD>
<TD><CODE>(anchor-class-name)</CODE></TD>
<TD>Removes the named AnchorClass (and all associated points) from the font.</TD>
</TR>
<TR>
<TD><CODE>removeLookup</CODE></TD>
<TD><CODE>(lookup-name[,remove_acs])</CODE></TD>
<TD>Remove the lookup (and any subtables within it). remove_acs (0 or 1),
specifies whether to remove associated anchor classes and points.</TD>
</TR>
<TR>
<TD><CODE>removeLookupSubtable</CODE></TD>
<TD><CODE>(subtable-name[,remove_acs])</CODE></TD>
<TD>Remove the subtable (and all data associated with it). remove_acs (0 or 1),
specifies whether to remove associated anchor classes and points</TD>
</TR>
<TR>
<TD><CODE>removeGlyph</CODE></TD>
<TD><CODE>(uni[,name])<BR>
(name)<BR>
(glyph)</CODE></TD>
<TD>You may either pass in a FontForge glyph object (from this font) or identify
a glyph in the font by unicode code point or name. In any case the glyph
will be removed from the font.
<P>
If you use (uni,name) to specify a name, set uni to -1.
<P>
<STRONG>WARNING:</STRONG> This frees fontforge's storage to this glyph. If
you have any python pointers to that storage they will be looking at garbage.
This does not go through the usual python reference mechanism.</TD>
</TR>
<TR>
<TD><CODE>replaceAll</CODE></TD>
<TD><CODE>(srch,rpl[,error-bound])</CODE></TD>
<TD>Searches the font for all occurences of the srch contour (or layer) and
replaces them with the replace contour (or layer).</TD>
</TR>
<TR>
<TD><CODE><A name="font-revert">revert</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Reloads the font from the disk.
<P>
<B>Caveat:</B> if you have any pointers to glyphs which live in the font
those pointers will no longer be valid, and using them will cause crashes.
This is very un-python-like.</TD>
</TR>
<TR>
<TD><CODE>revertFromBackup</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Reloads the font from the backup file on the disk.
<P>
<B>Caveat:</B> if you have any pointers to glyphs which live in the font
those pointers will no longer be valid, and using them will cause crashes.
This is very un-python-like.</TD>
</TR>
<TR>
<TD><CODE><A name="font-save">save</A></CODE></TD>
<TD><CODE>([filename])</CODE></TD>
<TD>Saves the font to an sfd file. See also
<A href="#f-generate">generate()</A></TD>
</TR>
<TR>
<TD><CODE>saveNamelist</CODE></TD>
<TD><CODE>(filename)</CODE></TD>
<TD>Saves the font's namelist to a file.</TD>
</TR>
<TR>
<TD><CODE>getTableData</CODE></TD>
<TD><CODE>(table-name)</CODE></TD>
<TD>Gets binary data from any saved table. FF will save 'fpgm', 'prep', 'cvt
' and 'maxp'. FF may also save tables which you explicitly request. Do not
expect to get binary data for tables like 'GPOS' or 'glyf' which FF will
generate when it creates a font... that information is not currently available.
<P>
Returns a binary string.</TD>
</TR>
<TR>
<TD><CODE>setTableData</CODE></TD>
<TD><CODE>(table-name,sequence)</CODE></TD>
<TD>Sets binary data of any saved table. FF will save 'fpgm', 'prep', 'cvt
' and 'maxp'. FF may also save tables which you explicitly request. Do not
expect to set binary data for tables like 'GPOS' or 'glyf' which FF will
generate when it creates a font... that information is not currently available.
<P>
If sequence is None, then the named table will be removed from the font.</TD>
</TR>
<TR>
<TD><CODE>validate</CODE></TD>
<TD><CODE>([force])</CODE></TD>
<TD>Validates the font and returns a bit mask of all errors from all glyphs
(as defined in the
<CODE><A HREF="python.html#validation-state">validation_state</A></CODE>
of a glyph -- except bit 0x1 is clear). If the font passed the validation
then the return value will be 0 (not 0x1). Otherwise the return value will
be the set of errors found.
<P>
Note: The set of errors is slightly different for TrueType and PostScript
output. The returned mask contains the list of potential errors. You must
figure out which apply to you.
<P>
Normally each glyph will cache its validation_state and it will not be
recalculated. If you pass a non-zero argument to the routine then it will
force recalculation of each glyph -- this can be slow.s</TD>
</TR>
<TR>
<TH colspan=3>Selection based interface<BR>
See the <A href="#selection">selection type</A> for how to alter the selection</TH>
</TR>
<TR>
<TD><CODE>addExtrema</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Extrema should be marked by on-curve points. If a curve in any selected
glyph lacks a point at a significant extremum this command will add one.</TD>
</TR>
<TR>
<TD><CODE>addSmallCaps</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>For all selected upper or lower case letters in the latin, greek and
cyrillic scripts this will try to create a small caps version of that glyph
in a new glyph slot. So if you select "A" (or "a") then a glyph "a.sc" will
be created (if "a.sc" already exists, it will be reused, and its current
contents cleared). The contents of "a.sc" will be based on the upper case
variant of this glyph (and that variant must be present for the command to
work). FontForge will also create two lookups (unless appropriate ones already
exist) one, bound to the feature 'c2sc' will map upper case letters to small
caps, the other, bound to feature 'smcp' will map lower case letters to small
caps.</TD>
</TR>
<TR>
<TD><CODE>autoHint</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Generates PostScript hints for all selected glyphs.</TD>
</TR>
<TR>
<TD><CODE>autoInstr</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Generates TrueType instructions for all selected glyphs.</TD>
</TR>
<TR>
<TD><CODE>autoWidth</CODE></TD>
<TD><CODE>(separation [,minBearing=,maxBearing=,height=,loopCnt=])</CODE></TD>
<TD>Guesses at reasonable horizontal advance widths for the selected glyphs</TD>
</TR>
<TR>
<TD><CODE>autoTrace</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Auto traces any background images in all selected glyphs</TD>
</TR>
<TR>
<TD><CODE>build</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>If any of the selected characters is a composite character, then this
command will clear it and insert references to its components (this command
can create new glyphs).</TD>
</TR>
<TR>
<TD><CODE>canonicalContours</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Orders the contours in the selected glyphs by the x coordinate of their
leftmost point. (This can reduce the size of the charstring needed to describe
the glyph(s).</TD>
</TR>
<TR>
<TD><CODE>canonicalStart</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Sets the start point of all the contours of the selected glyphs to be
the leftmost point on the contour. (If there are several points with that
value then use the one which is closest to the baseline). This can reduce
the size of the charstring needed to describe the glyph(s). By regularizing
things it can also make more things available to be put in subroutines.</TD>
</TR>
<TR>
<TD><CODE>changeWeight</CODE></TD>
<TD><CODE>(stroke_width[,type,<BR>
serif_height,serif_fuzz,<BR>
counter_type,custom_zones])</CODE></TD>
<TD>See the <A HREF="Styles.html#Embolden">Element->Style->Change
Width</A> command for a more complete description of these arguments.
<P>
Stroke_width is the amount by which all stems are expanded.
<P>
Type is one of "LCG", "CJK", "auto", "custom".
<P>
Serif_height tells ff not to expand serifs which are that much off the baseline,
while serif_fuzz specifies the amount of fuzziness allowed in the match.
If you don't want special serif behavior set this to 0.
<P>
Counter_type is one of "squish", "retain", "auto".
<P>
Custom_zones is only meaningful if the type argument were "custom". It may
be either a number, which specifies the "top hint" value (bottom hint is
assumed to be 0, others are between), or a tuple of 4 numbers (top hint,
top zone, bottom zone, bottom hint).</TD>
</TR>
<TR>
<TD><CODE>condenseExtend</CODE></TD>
<TD><CODE>(c_factor,c_add<BR>
[,sb_factor,sb_add,<BR>
correct])</CODE></TD>
<TD>Condenses or extends the size of the counters and side-bearings of the
selected glyphs. The first two arguments provide information on shrinking/growing
the counters, the second two the sidebearings. If the last two are omitted
they default to the same values as the first two.
<P>
A counter's width will become:<BR>
<CODE> new_width = c_factor * old_width + c_add</CODE>
<P>
If present the <CODE>correct</CODE> argument allows you to specify whether
you want to correct for the italic angle before condensing the glyph. (it
defaults to True)</TD>
</TR>
<TR>
<TD><CODE>clear</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Clears the contents of all selected glyphs</TD>
</TR>
<TR>
<TD><CODE><A name="f-cluster">cluster</A></CODE></TD>
<TD><CODE>([within,max])</CODE></TD>
<TD>Moves clustered coordinates to a standard central value in all selected
glyphs. See also <A href="#f-round">round</A>.</TD>
</TR>
<TR>
<TD><CODE>copy</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Copies all selected glyphs into (fontforge's internal) clipboard.</TD>
</TR>
<TR>
<TD><CODE>copyReference</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Copies all selected glyphs (as references) into (fontforge's internal)
clipboard.</TD>
</TR>
<TR>
<TD><CODE><A name="f-correctDirection">correctDirection</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Orients all contours so that external ones are clockwise and internal
counter-clockwise in all selected glyphs.</TD>
</TR>
<TR>
<TD><CODE>correctReferences</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Checks a font for glyphs with mixed contours and references (or references
with transformation matrices which cannot be represented truetype (ie. scaling
by 2 or more)). If a mixed case is discovered fontforge will take the contours
out of the glyph, put them in a new glyph, and make a reference to the new
glyph.</TD>
</TR>
<TR>
<TD><CODE>cut</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Copies all selected glyphs into (fontforge's internal) clipboard. And
then clears them.</TD>
</TR>
<TR>
<TD><CODE>paste</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Pastes the contents of (fontforge's internal) clipboard into the selected
glyphs -- and removes what was there before.</TD>
</TR>
<TR>
<TD><CODE><A name="f-intersect">intersect</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Leaves only areas in the intersection of contours in all selected glyphs.
See also <A href="#f-removeOverlap">removeOverlap</A>.</TD>
</TR>
<TR>
<TD><CODE>pasteInto</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Pastes the contents of (fontforge's internal) clipboard into the selected
glyphs -- and retains what was there before.</TD>
</TR>
<TR>
<TD><CODE><A name="f-removeOverlap">removeOverlap</A></CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Removes overlapping areas in all selected glyphs. See also
<A href="#f-intersect">intersect</A>.</TD>
</TR>
<TR>
<TD><CODE>replaceWithReference</CODE></TD>
<TD><CODE>([fudge])</CODE></TD>
<TD>Finds any glyph which contains an inline copy of one of the selected
glyphs, and converts that copy into a reference to the appropriate glyph.
Selection is changed to the set of glyphs which the command alters.
<P>
If specified the fudge argument specifies the error allowed for coordinate
differences.</TD>
</TR>
<TR>
<TD><CODE><A name="f-round">round</A></CODE></TD>
<TD><CODE>([factor])</CODE></TD>
<TD>Rounds the x and y coordinates of each point in all selected glyphs.
If factor is specified then new-coord = round(factor*old-coord)/factor. See
also <A href="#f-cluster">cluster</A>.</TD>
</TR>
<TR>
<TD><CODE>simplify</CODE></TD>
<TD><CODE>([error-bound,flags,tan_bounds,<BR>
linefixup,linelenmax])</CODE></TD>
<TD>Tries to remove excess points in all selected glyphs if doing so will
not perturb the curve by more than <CODE>error-bound</CODE>. Flags is a tuple
of the following strings
<DL>
<DT>
ignoreslopes
<DD>
Allow slopes to change
<DT>
ignoreextrema
<DD>
Allow removal of extrema
<DT>
smoothcurves
<DD>
Allow curve smoothing
<DT>
choosehv
<DD>
Snap to horizontal or vertical
<DT>
forcelines
<DD>
flatten bumps on lines
<DT>
nearlyhvlines
<DD>
Make nearly horizontal/vertical lines be so
<DT>
mergelines
<DD>
Merge adjacent lines into one
<DT>
setstarttoextremum
<DD>
Rotate the point list so that the start point is on an extremum
<DT>
removesingletonpoints
<DD>
If the contour contains just one point then remove it
</DL>
</TD>
</TR>
<TR>
<TD><CODE>stroke</CODE></TD>
<TD><CODE>("circular",width[,<BR>
linecap,linejoin,flags])<BR>
("eliptical",width,<BR>
minor-width,angle<BR>
[,linecap,linejoin,flags])<BR>
("caligraphic",width,<BR>
height,angle[,flags])<BR>
("polygonal",contour[,flags])</CODE></TD>
<TD>Strokes the contours of all selected glyphs using one of the indicated
pens. Line cap may be one of
<UL>
<LI>
butt
<LI>
round
<LI>
square
</UL>
<P>
line join may be
<UL>
<LI>
miter
<LI>
round
<LI>
bevel
</UL>
<P>
flags is a tuple containing some of the following strings
<UL>
<LI>
removeinternal
<LI>
removeexternal
<LI>
cleanup
</UL>
<P>
If a polygonal pen is specified the contour must be a closed convex polygon
(no curved edges) with fewer than 100 vertices.</TD>
</TR>
<TR>
<TD><CODE>transform</CODE></TD>
<TD><CODE>(matrix)</CODE></TD>
<TD>Transforms all selected glyphs by the matrix.</TD>
</TR>
<TR>
<TD><CODE>nltransform</CODE></TD>
<TD><CODE>(xexpr,yexpr)</CODE></TD>
<TD>xexpr and yexpr are strings specifying non-linear transformations that
will be applied to all points in the selected glyphs of the font (with xexpr
being applied to x values, and yexpr to y values, of course). The syntax
for the expressions is explained in the
<A HREF="transform.html#Non-Linear">non-linear transform dialog</A>.</TD>
</TR>
<TR>
<TD><CODE>unlinkReferences</CODE></TD>
<TD><CODE>()</CODE></TD>
<TD>Unlinks all references in all selected glyphs and replaces them with
splines.</TD>
</TR>
</TABLE>
<H3>
Stupid example
</H3>
<TABLE BORDER=1>
<TR>
<TD><PRE>import fontforge #Load the module
amb=fontforge.open("Ambrosia.sfd") #Open a font
amb.selection.select(("ranges",None),"A","Z") #select A-Z
amb.copy() #Copy those glyphs into the clipboard
n=fontforge.font() #Create a new font
n.selection.select(("ranges",None),"A","Z") #select A-Z of it
n.paste() #paste the glyphs above in
print n["A"].foreground #test to see that something
# actually got pasted
n.fontname="NewFont" #Give the new font a name
n.save("NewFont.sfd") #and save it.
</PRE>
</TD>
</TR>
</TABLE>
<H2>
FontForge as a python <A NAME="extension">extension</A>
</H2>
<P>
When Fontforge is installed, it also installs a Python module, which can be accessed from Python using:
<BLOCKQUOTE id="shell">
<PRE><FONT COLOR="Gray">>>> </FONT>import fontforge
</PRE>
</BLOCKQUOTE>
</DIV>
</BODY></HTML>
|