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
|
% \CheckSum{4033}
% \iffalse meta-comment
%
% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey,
% hacked and maintained 1997, 1998 Sebastian Rahtz,
% copyright 1998, 1999, 2000 the fontinst maintenance team and any
% individual authors listed elsewhere in this file. All rights reserved.
%
% This file is part of the fontinst system version 1.9.
% -----------------------------------------------------
%
% It may be distributed under the terms of the LaTeX Project Public
% License, as described in lppl.txt in the base LaTeX distribution.
% Either version 1.1 or, at your option, any later version.
%
%%% From file: fimain.dtx
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{fisource}
\title{The \package{fontinst} utility}
\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om}
\begin{document}
\maketitle
\tableofcontents
\DocInput{fimain.dtx}
\end{document}
%</driver>
% \fi
%
% \StopEventually{}
%
%
% \section{Encoding files}
%
% \changes{1.911}{1999/11/21}{Definitions of encoding file commands
% added to \protect\protect\protect\Module{misc}. (LH)}
%
% \DescribeMacro{\inputetx}
% The macro
% \begin{quote}
% |\inputetx|\marg{filename}
% \end{quote}
% inputs \meta{filename}|.etx|, ignoring anything between |\relax|
% and |\encoding|, and anything after |\endencoding|.
%
% The file name is transformed to lowercase before opening.
%
% \begin{macro}{\inputetx}
% \begin{macro}{\encoding}
% \changes{1.900}{1999/02/07}
% {Changed group in fontdoc to \cs{begingroup} type. (LH)}
% \usechange{raggedright}
% \begin{macro}{\endencoding}
% \changes{1.900}{1999/02/07}{Made it outer. (LH)}
% \usechange{raggedright}
% \begin{macrocode}
%<*pkg|misc>
\def\inputetx#1{
\edef\lowercase_file{\lowercase{
\edef\noexpand\lowercase_file{#1}}}
\lowercase_file
\slot_number=0
\def\relax{\let\relax=\x_relax\iffalse}
\let\encoding=\fi
\primitiveinput \lowercase_file.etx\x_relax
\let\relax=\x_relax
}
\let\encoding=\relax
\outer\def\endencoding{\endinput}
%</pkg|misc>
% \end{macrocode}
%
% Things are a bit more complicated in \package{fontdoc}, since the
% |\relax| \textellipsis\ |\encoding| \textellipsis\ |\endencoding|
% markup must be able to work in two different ways. In the main file
% only |\encoding| actually does anything---it sets |\slot@number| to
% zero. In a file that is being |\inputetx|ed, they must work as with
% \package{fontinst}: Everything between |\relax| and |\encoding|,
% and everything after |\endencoding| must be ignored.
% \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27}
% {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)}
% \multchanges{\cs{encoding}\cs{endencoding}}{1.918}{2001/06/19}
% {Added \cs{par} and \cs{addvspace} to \package{fontdoc}
% definitions. (LH)}
% \multchanges{\cs{endencoding}}{1.919}{2001/09/01}
% {Added setting of \cs{parindent} to 1\,em to \package{fontdoc}
% definition. (LH)}
% \begin{macrocode}
%<*doc>
\def\inputetx#1{%
\begingroup
\edef\lowercase@file{\lowercase{%
\edef\noexpand\lowercase@file{#1}%
}}%
\lowercase@file
\global\slot@number=0%
\FD@slot@known@true
\IfFileExists{\lowercase@file.etx}{%
\FD@relax@encoding@tricks
\@@input \@filef@und
\let\relax=\x@relax
}{%
\PackageError{fontdoc}{File #1.etx not found}%
{\@eha\MessageBreak You can \protect\inputetx\space
some other file now, if you want.}%
}
\endgroup
}
% \end{macrocode}
% \begin{macro}{\FD@relax@encoding@tricks}
% There is a problem with |\if| \dots\ |\fi| nesting in the
% redefinition of |\relax| and |\encoding|, which interacts badly
% with |\IfFileExists|. To work around that, these redefinitions
% are hidden in the |\FD@relax@encoding@tricks| macro.
% \changes{1.928}{2004/11/24}{Macro added, to fix bug reported by
% Peter Dyballa. (LH)}
% \begin{macrocode}
\def\FD@relax@encoding@tricks{%
\def\relax{\let\relax=\x@relax\iffalse}%
\let\encoding=\fi
\outer\x@cs\def{endencoding}{\endinput}%
}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
\def\encoding{%
\par
\ifFD@spec@ \addvspace{\bigskipamount}\fi
\begin{flushleft}
\global\slot@number=\z@
}
\outer\def\endencoding{%
\end{flushleft}
\ifFD@spec@ \addvspace{\bigskipamount}\fi
}
%</doc>
% \end{macrocode}
% \end{macro} \end{macro} \end{macro}
%
%
% \begin{macro}{\setslot}
% \changes{1.917}{2001/03/23}{Made slots referencable using
% \cs{label}. (LH)}
% \begin{macro}{\endsetslot}
% \begin{macro}{\slot_name}
% |\setslot|\marg{name} \meta{slot commands} |\endsetslot|
%
% In \package{fontinst}, this sets |\slot_name| to \meta{name} and
% calls |\do_slot| at the beginning of the slot and it calls
% |\end_do_slot| and increments |\slot_number| by one at the end.
% By default, |\do_slot| and |\end_do_slot| do nothing, but this is
% over-ridden later.
%
% \begin{macrocode}
%<*pkg|misc>
\def\setslot#1{\edef\slot_name{#1}\do_slot}
\def\endsetslot{\end_do_slot\advance\slot_number by 1\x_relax}
%</pkg|misc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\slot@name}
% \changes{1.917}{2001/03/23}{Now storing the printable form of the
% name, rather than the raw code. (LH)}
% In \package{fontdoc}, the same code converts \meta{name} to a
% printable string and stores the result in |\slot@name|, prints an
% |\Aheading| heading for the slot which show the name and number
% of the slot, and prints the current automatic slot comment (if
% one has been set) at the beginning of the slot. At the end of
% the slot, it simply increments |\slot@number| by one.
%
% \begin{macrocode}
%<*doc>
\newcommand\setslot[1]{%
\protected@edef\slot@name{%
\noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}%
}%
\slot@name
\FD@tight@true
\Aheading{Slot
\ifFD@slot@known@
\the\slot@number\space
\else
\(\FD@slot@expression + \the\slot@number\)
\fi
`\FD@typeset@string{\slot@name}'%
}%
\protected@edef\@currentlabel{%
\ifFD@slot@known@
\the\slot@number
\else
\protect\(%
\FD@slot@expression+\the\slot@number
\protect\)%
\fi
\space(\protect\FD@typeset@string{\slot@name})%
}%
\ifFD@slot@known@ \ifslot@comment@ \comment{\slot@comment}\fi\fi
}
\def\endsetslot{%
\global\advance \slot@number \@ne
\FD@tight@false
}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\do_slot}
% \begin{macro}{\end_do_slot}
% \begin{macrocode}
%<*pkg|misc>
\let\do_slot\empty_command
\let\end_do_slot\empty_command
% \end{macrocode}
% \end{macro} \end{macro}
% \multchanges{\cs{do_new_slot}}{1.910}{1999/11/01}{Macro removed. (LH)}
%
% \begin{macro}{\nextslot}
% \begin{macro}{\skipslots}
% \begin{macro}{\slot_number}
% \begin{macro}{\slot@number}
% \begin{switch}{FD@slot@known@}
% \begin{macro}{\FD@slot@expression}
% |\nextslot|\marg{integer expression}\\
% |\skipslots|\marg{integer expression}
%
% In \package{fontinst}, |\nextslot| sets the |\slot_number| and
% |\skipslots| addvances the |\slot_number|.
%
% \begin{macrocode}
\newcount\slot_number
\def\nextslot#1{\eval_expr_to\slot_number{#1}}
\def\skipslots#1{\eval_expr{#1} \advance\slot_number by \result}
%</pkg|misc>
% \end{macrocode}
%
% The commands do the same in \package{fontdoc} as in
% \package{fontinst}, although they do it to |\slot@number| instead of
% |\slot_number|.
%
% \begin{macrocode}
%<*doc>
\newcount\slot@number
\def\FD@slot@known@true{\global\let\ifFD@slot@known@\iftrue}
\def\FD@slot@known@false{\global\let\ifFD@slot@known@\iffalse}
\FD@slot@known@true
\newcommand\nextslot[1]{%
\FD@evaluate@true
\FD@eval@expr{#1}%
\ifFD@evaluate@
\global\slot@number=\FD@result
\FD@slot@known@true
\else
\global\let\FD@slot@expression=\FD@expression
\global\slot@number=\z@
\FD@slot@known@false
\fi
}
\newcommand\skipslots[1]{%
\FD@evaluate@true
\FD@eval@expr{#1}%
\ifFD@evaluate@
\global\advance \slot@number \FD@result
\else
\ifFD@slot@known@
\global\let\FD@slot@expression=\FD@expression
\else
\protected@xdef\FD@slot@expression{%
\FD@slot@expression+\FD@expression
}%
\fi
\FD@slot@known@false
\fi
}
%</doc>
% \end{macrocode}
%
% There has been some ambiguity concerning what is allowed as
% arguments of \cs{nextslot} and \cs{skipslots}. At least since
% v\,1.335 the comments in the source has said it was an integer
% expression, but the implementation was for a \TeX\ number.
% Alan's v\,1.5 manual and Rowland's v\,1.8 manual both say the
% arguments must be numbers. Allowing arbitrary integer
% expressions with \package{fontinst} is trivial, the above
% implementation copes with that, but \package{fontdoc} gets in
% trouble, so what should we do about it? /LH
%
% AFAIK, all instances of |\nextslot| or |\skipslots| appearing in
% present |*.etx| files are explicit numbers, no fancy constructs. /UV
%
% No, but if a |\setslot| command appears in a |\for| loop then the
% slot number in that command will depend on the values of various
% integer expressions anyway, so we might as well deal with it. /LH
%
% The matter was finally resolved when \package{fontdoc} was
% augmented to handle (and typeset) arbtrary integer expressions.
%
% \multchanges{\cs{nextslot}\cs{skipslots}}{1.900}{1999/02/07}^^A
% {Made changes of \cs{slot@number} global. (LH)}
% \end{macro}\end{switch}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\setleftboundary}
% \multchanges{\cs{setleftboundary}\cs{endsetleftboundary}}^^A
% {1.909}{1999/10/19}{\package{fontdoc} definition added. (LH)}
% \changes{1.917}{2001/03/23}{Made the left boundary referencable
% using \cs{label}. (LH)}
% \begin{macro}{\endsetleftboundary}
% \begin{macro}{\do_boundary}
% |\setleftboundary|\marg{glyph} \meta{slot commands}
% |\endsetleftboundary|
%
% These macros are like |\setslot| and |\endsetslot|, but they merely
% set the left boundary ligkern program, they do not cause any
% |CHARACTER| property list to be written. Thus the only metric
% information connected to the \meta{glyph} argument that is ever used
% is the kerns with this glyph on the left.
%
% |\do_boundary| and |\endsetleftboundary| are initally |\relax|, but
% are later redefined.
%
% \begin{macrocode}
%<*pkg>
\def\setleftboundary#1{\edef\slot_name{#1}\do_boundary}
\let\endsetleftboundary\x_relax
\let\do_boundary\x_relax
%</pkg>
%<*doc>
\newcommand\setleftboundary[1]{%
\protected@edef\slot@name{%
\noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}%
}%
\slot@name
\FD@tight@true
\Aheading{Left boundary `\FD@typeset@string{\slot@name}'}%
\protected@edef\@currentlabel{%
left boundary (\protect\FD@typeset@string{\slot@name})%
}%
}
\let\endsetleftboundary=\FD@tight@false
%</doc>
%<*misc>
\let\setleftboundary=\gobble_one
\let\endsetleftboundary=\x_relax
%</misc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
%
% \begin{macro}{\setrightboundary}
% |\setrightboundary|\marg{glyph}
%
% The |\setrightboundary| macro should be used to set which slot in
% the font is used as right boundary marker if that slot is empty. It
% advances |\slot_number| just like a |\setslot| \textellipsis\
% |\endsetslot| pair, but since the slot will be left empty, there is
% no need for any \meta{slot commands}, and hence there is no need for
% a closing |\endset|\textellipsis\ command either.
%
% If the right boundary marker slot is not to be left empty (often
% unavoidable), then one should use the slot command
% |\makerightboundary| instead.
%
% \changes{1.909}{1999/10/19}{doc definition added. (LH)}
% \begin{macrocode}
%<*pkg|misc>
\def\setrightboundary#1{
\makerightboundary{#1}
\advance \slot_number 1\x_relax
}
%</pkg|misc>
%<*doc>
\newcommand\setrightboundary[1]{%
\Aheading{Right boundary slot
\ifFD@slot@known@
\the\slot@number\space
\else
\(\FD@slot@expression + \the\slot@number\)
\fi
`\TypesetStringExpression{#1}'%
}%
\global\advance \slot@number \@ne
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% \DescribeMacro{\ligature}
% \DescribeMacro{\Ligature}
% \DescribeMacro{\oddligature}
% \DescribeMacro{\nextlarger}
% \DescribeMacro{\varchar}
% \DescribeMacro{\endvarchar}
% \DescribeMacro{\usedas}
% \DescribeMacro{\makerightboundary}
% \DescribeMacro{\Unicode}
% The \meta{slot commands} are:
% \begin{quote}
% |\ligature|\marg{lig}\marg{glyph}\marg{glyph}\\
% |\Ligature|\marg{lig}\marg{glyph}\marg{glyph}\\
% |\oddligature|\marg{note}\marg{lig}\marg{glyph}\marg{glyph}\\
% |\nextlarger|\marg{glyph}\\
% |\varchar| \meta{varchar commands} |\endvarchar|\\
% |\usedas|\marg{command}\marg{type}\\
% |\makerightboundary|\marg{glyph}\\
% |\Unicode|\marg{code point}\marg{name}
% \end{quote}
% By default, these do nothing in \package{fontinst}, but most of
% those defaults are overridden locally in those situations where one
% wants them to do something. Exceptions are \cs{usedas},
% which is never used at all AFAIK,\footnote{It was intended to be
% used for math font encodings, but that never got off the
% \texttt{TODO} list. /LH} and |\oddligature| and |\Unicode|,
% which are purely documentation commands. In \package{fontdoc},
% they generate descriptive headings.
%
% \begin{macro}{\ligature}
% \begin{macro}{\Ligature}
% \changes{1.917}{2001/03/31}{Command added. (LH)}
% \begin{macro}{\oddligature}
% \changes{1.918}{2001/05/31}{Command added. (LH)}
% The |\ligature| and |\Ligature| commands have the same syntax and
% meaning to \package{fontinst}, but \package{fontdoc} can give them
% slightly different treatment. In a specification ETX file, the
% |\Ligature| command gets the heading ``Mandatory ligature'', whereas
% the |\ligature| command gets the heading ``Ordinary ligature''.
%
% The |\oddligature| command takes a fourth argument which contains a
% short note on when the ligature might be appropriate. The entire
% command is always ignored by \package{fontinst}.
% \begin{macrocode}
%<pkg|misc>\let\ligature=\gobble_three
%<pkg|misc>\def\Ligature{\ligature}
%<pkg|misc>\def\oddligature#1#2#3#4{}
%<*doc>
\newcommand\ligature[3]{%
\Bheading{\ifFD@spec@ Ordinary ligature\else Ligature\fi}
\@nameuse{FD@lig-#1}{#2}{#3}%
}
\newcommand\Ligature[3]{%
\Bheading{\ifFD@spec@ Mandatory ligature\else Ligature\fi}
\@nameuse{FD@lig-#1}{#2}{#3}%
}
\newcommand\oddligature[4]{%
\Bheading{Odd\footnote{#1} ligature}
\@nameuse{FD@lig-#2}{#3}{#4}%
}
% \end{macrocode}
%
% Symbolic typesetting of |\ligature| programs requires
% special processing.\describecsfamily{FD@lig-\meta{lig}}
% \multchanges{\cs{FD@lig-/LIG\PrintChar{`>}}\cs
% {FD@lig-LIG/\PrintChar{`>}}\cs{FD@lig-/LIG/\PrintChar{`>}}\cs
% {FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.917}
% {2001/03/31}{Changed how \package{fontdoc} marks the current
% position after a ligature instruction, from $+$ to
% $*\lfloor$. (LH)}
% \multchanges{\cs{FD@lig-/LIG}}{1.927}
% {2004/06/21}{Fixed a typo. (LH) Reported by Werner Lemberg.}
% \multchanges{\cs{FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.927}
% {2004/06/24}{Fixed a typo. (LH) Reported by Werner Lemberg.}
%
% \begin{macrocode}
\x@cs\def{FD@lig-LIG}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$\typeset@glyph{#2}%
}
\x@cs\def{FD@lig-/LIG}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#2}%
}
\x@cs\def{FD@lig-LIG/}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
}
\x@cs\def{FD@lig-/LIG/}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\FD@typeset@string{\slot@name}${}*{}$%
\typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
}
\x@cs\def{FD@lig-/LIG>}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\FD@typeset@string{\slot@name}${}*\lfloor$\typeset@glyph{#2}%
}
\x@cs\def{FD@lig-LIG/>}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}%
}
\x@cs\def{FD@lig-/LIG/>}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\FD@typeset@string{\slot@name}${}*\lfloor$%
\typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
}
\x@cs\def{FD@lig-/LIG/>>}#1#2{%
\FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
${}\rightarrow{}$%
\FD@typeset@string{\slot@name}${}*{}$%
\typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}%
}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
%
% \begin{macro}{\nextlarger}
% \begin{macro}{\usedas}
% \begin{macro}{\makerightboundary}
% \begin{macrocode}
%<*pkg|misc>
\let\nextlarger=\gobble_one
\let\usedas=\gobble_two
\let\makerightboundary=\gobble_one
%</pkg|misc>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\def\nextlarger#1{\Bheading{Next larger} \typeset@glyph{#1}}
\def\makerightboundary#1{%
\Bheading{Right boundary marker slot} designation \typeset@glyph{#1}%
}
%</doc>
% \end{macrocode}
% \missing{doc}{\usedas}
% \end{macro} \end{macro} \end{macro}
%
%
% \begin{macro}{\Unicode}
% \changes{1.917}{2001/03/13}{Command added. (LH)}
% \changes{1.917}{2001/03/31}{Added setting of \cs{linepenalty} and
% \cs{spaceskip}. (LH)}
% \begin{macro}{\textunicode}
% \changes{1.918}{2001/06/17}{Command added. (LH)}
% \begin{macro}{\FD@codepoint}
% \changes{1.918}{2001/06/17}{Macro added. (LH)}
% \begin{macro}{\FD@charname}
% \changes{1.918}{2001/06/17}{Macro added. (LH)}
% Since ISO\,10646\slash Unicode has become the primary reference for
% identifying characters, we provide a special comment command for
% specifying which Unicode character corresponds to a particular slot
% in an encoding. \label{Unicode} The syntax is
% \begin{quote}
% |\Unicode|\marg{code point}\marg{name}
% \end{quote}
% where the \meta{code point} is the four hexadecimal digits that
% identify the code point of the character and \meta{name} is the
% name of the character. An example is
% \begin{quote}
% |\Unicode{0041}{LATIN CAPITAL LETTER A}|
% \end{quote}
% which is typeset as
% \begin{quote}
% Unicode character \texttt{U+0041}, \textsc{latin capital letter a}.
% \end{quote}
% The \meta{name} field may be left empty.
%
% The |\Unicode| command makes a whole |\comment|, but it is also
% useful to have a similar command for writing such data as part of a
% longer paragraph. The |\textunicode| command, which has the same
% argument structure as |\Unicode|, is provided for this. If you write
% \begin{quote}
% |see also \textunicode{0041}{LATIN CAPITAL LETTER A} for|
% \end{quote}
% then this is typeset as
% \begin{quote}
% see also \texttt{U+0041} (\textsc{latin capital letter a}) for
% \end{quote}
%
% As case is not significant in the character names and they
% furthermore usually seem to be written in capitals, I have chosen
% to typeset them using small capitals only. This is done by
% |\FD@charname|. The |\FD@codepoint| macro similarly handles
% typesetting of code points. See also the \texttt{hypertex} option
% to the \package{fontdoc} package.
%
% The \package{fontinst} and \package{finstmsc} definitions of
% |\Unicode| are to gobble the arguments.
% \begin{macrocode}
%<pkg|misc>\let\Unicode=\gobble_two
%<*doc>
\newcommand*\Unicode[2]{%
\comment{%
\spaceskip=\fontdimen2\font minus 1.1\fontdimen4\font
Unicode character \FD@codepoint{#1}%
\ifx \par#2\par \else , \FD@charname{#2}\fi.%
\linepenalty=300\par
}%
}
\newcommand*\textunicode[2]{%
\FD@codepoint{#1} \ifx\par#2\par\else(\FD@charname{#2})\fi
}
\providecommand*\FD@codepoint[1]{\texttt{U+\uppercase{#1}}}
\providecommand*\FD@charname[1]{\textsc{\lowercase{#1}}}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\charseq}
% Most commonly occurring glyphs correspond to one |\Unicode|
% character, but this is not at all true in general---in fact there
% may even be letters which cannot be encoded as single characters,
% as they do not exist in precomposed form but have to be expressed
% with a base letter and combining diacritical mark. Reasonable
% compliance with the standard requires supporting character
% sequences as well as individual characters.
% \changes{1.928}{2004/11/27}{Command added. (LH)}
% \changes{1.928}{2004/12/16}{Typeset form changed, from paragraph to
% a one-item-per-line list. (LH)}
%
% In \package{fontinst}, the |\charseq| command is used to specify
% such a character sequence. The syntax is
% \begin{quote}
% |\charseq|\marg{\cs{Unicode} commands}
% \end{quote}
% where the \meta{\cs{Unicode} commands} is one or several |\Unicode|
% commands. This means the sequence of those characters. For example
% \begin{quote}
% |\charseq{|\\
% | \Unicode{0066}{LATIN SMALL LETTER F}|\\
% | \Unicode{0069}{LATIN SMALL LETTER I}|\\
% |}|
% \end{quote}
% is typeset as
% \begin{quote}
% Unicode character sequence:\\
% \vadjust{}\quad\texttt{U+0066} (\textsc{latin small letter f})\\
% \vadjust{}\quad\texttt{U+0069} (\textsc{latin small letter i})
% \end{quote}
% This indentation is made using the \texttt{IfBranch} environment,
% which could be considered a bit hackish.
%
% |\charseq| is gobbled in \Module{pkg} and \Module{misc}, but in the
% latter case it might get redefined.
% \begin{macrocode}
%<pkg|misc>\let\charseq=\gobble_one
% \end{macrocode}
% Note how the environment group restores the definition
% of |\Unicode|.
% \begin{macrocode}
%<*doc>
\newcommand\charseq[1]{%
\comment{Unicode character sequence:}%
\begin{IfBranch}%
\def\Unicode##1##2{%
\noindent\FD@codepoint{##1}
\ifx\par##2\par\else(\FD@charname{##2})\fi
\par
}%
#1%
\end{IfBranch}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% \DescribeMacro{\vartop}
% \DescribeMacro{\varmid}
% \DescribeMacro{\varbot}
% \DescribeMacro{\varrep}
% The \meta{varchar commands} are:
% \begin{quote}
% |\vartop|\marg{glyph}\\
% |\varmid|\marg{glyph}\\
% |\varbot|\marg{glyph}\\
% |\varrep|\marg{glyph}
% \end{quote}
% These too do by default, which is overridden later, nothing in
% \package{fontinst} but typeset descriptive headings in \package{fontdoc}.
%
% \begin{macro}{\varchar}
% \begin{macro}{\vartop}
% \begin{macro}{\varmid}
% \begin{macro}{\varbot}
% \begin{macro}{\varrep}
% \begin{macro}{\endvarchar}
% \begin{macrocode}
%<*pkg|misc>
\let\varchar=\empty_command
\let\vartop=\gobble_one
\let\varmid=\gobble_one
\let\varbot=\gobble_one
\let\varrep=\gobble_one
\let\endvarchar=\empty_command
%</pkg|misc>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\def\varchar{\Bheading{Extensible glyph:}}
\def\vartop#1{\Bheading{Top} \typeset@glyph{#1}}
\def\varmid#1{\Bheading{Middle} \typeset@glyph{#1}}
\def\varbot#1{\Bheading{Bottom} \typeset@glyph{#1}}
\def\varrep#1{\Bheading{Repeated} \typeset@glyph{#1}}
\let\endvarchar\relax
%</doc>
% \end{macrocode}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
%
%
% \begin{macro}{\useexamplefont}
% \begin{macro}{\slotexample}
% \begin{macro}{\setslotcomment}
% \begin{macro}{\resetslotcomment}
% \begin{macro}{\unsetslotcomment}
% \begin{macro}{\slot@comment}
% \begin{macro}{\slot@font}
% As of v\,1.8 of \package{fontinst}, we have added an interface
% for automatic documentation of encoding files, which has been
% developed by Matthias Clasen as part of his work on math fonts.
% The implementation was slightly modified and integrated into
% this version by Ulrik Vieth.
%
% |\setslotcomment| defines a default slot comment, stored in the
% variable |\slot@comment|, which is subsequently used to annotate
% all |\setslot| commands. The slot comment can be changed by
% |\resetslotcomment| or turned off by |\unsetslotcomment|.
%
% |\useexamplefont| defines a default font, |\slot@font|, which
% may be referenced by calling |\slotexample| in slot comments to
% display the character or symbol allocated to the current slot.
%
% Taking advantage of this mechanism, it is possible to write:
% \begin{quote}
% |\useexamplefont{FONT}|\\[0.5\baselineskip]
% |\setslotcomment{The symbol `\slotexample'.}|\\
% |\setslot{FOO}\endsetslot|\\
% |\setslot{BAR}\endsetslot|\\
% |\resetslotcomment{The character `\slotexample'.}|\\
% |\setslot{BAZ}\endsetslot|
% \end{quote}
% instead of having to write:
% \begin{quote}
% |\usepackage{PACKAGE-to-use-symbols-from-FONT}|\\[0.5\baselineskip]
% |\setslot{FOO}\comment{The symbol `\foo'.}\endsetslot|\\
% |\setslot{BAR}\comment{The symbol `\bar'.}\endsetslot|\\
% |\setslot{BAZ}\comment{The character `\baz'.}\endsetslot|
% \end{quote}
%
% These macros never do anything in \package{fontinst}, they just
% gobble their arguments.
% \begin{macrocode}
%<*pkg|misc>
\let\useexamplefont=\gobble_one
\let\slotexample=\empty_command
\let\setslotcomment=\gobble_one
\let\resetslotcomment=\gobble_one
\let\unsetslotcomment=\empty_command
%</pkg|misc>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newif\ifslot@comment@
\slot@comment@false
\def\slot@comment{}
\newcommand\setslotcomment[1]{%
\slot@comment@true
\gdef\slot@comment{#1}%
}
\newcommand\resetslotcomment[1]{\gdef\slot@comment{#1}}
\newcommand\unsetslotcomment{%
\slot@comment@false
\global\let\slot@comment\@empty
}
% \end{macrocode}
%
% \begin{macrocode}
\let\slot@font=\nullfont
\newcommand\useexamplefont[1]{\font\slot@font=#1 }
\newcommand\slotexample{%
\ifFD@slot@known@{\slot@font\char\slot@number}\fi
}
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setfontdimen}
% \changes{1.917}{2001/03/16}{Command added. (LH)}
% The |\setfontdimen| command is used in an ETX file to set a font
% dimen. The syntax is
% \begin{quote}
% |\setfontdimen|\marg{fontdimen no.}\marg{integer}
% \end{quote}
% where \meta{fontdimen no.} and \meta{integer} are \emph{string}
% expressions. \meta{fontdimen no.} specifies the fontdimen to set.
% \meta{integer} is the name of the integer variable to whose value
% the fontdimen will be set.
%
% When used in font installation, the above |\setfontdimen| command
% is equivalent to
% \changes{1.923}{2002/10/25}{Leave the fontdimen unset when the
% integer variable has not been set. (LH)}
% \begin{quote}
% |\ifisint|\marg{integer}|\then|\\
% | \setint{fontdimen(|\meta{fontdimen no.}|)}{\int{|^^A
% \meta{integer}|}}|\\
% |\fi|
% \end{quote}
% but |\setfontdimen| is also understood by the (V)PL-to-MTX
% converter as declaring an integer that the generated MTX file
% should set to the value of the fontdimen in the (V)PL.
% \begin{macrocode}
%<*pkg>
\def\setfontdimen#1#2{
\ifisint{#2}\then \setint{fontdimen(#1)}{\int{#2}} \fi
}
%</pkg>
%<misc>\let\setfontdimen\gobble_two
%<*doc>
\newcommand\setfontdimen[2]{%
\Bheading{Fontdimen} \TypesetStringExpression{#1} is
\(\TypesetIntegerExpression{\int{#2}}\)%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\label}
% \changes{1.917}{2001/03/23}{Macro added. (LH)}
% \package{fontinst} and \package{finstmsc} defines the \LaTeX\
% |\label| command to gobble its argument, so that one can use it to
% reference slots.
% \begin{macrocode}
%<pkg|misc>\let\label=\gobble_one
% \end{macrocode}
% \end{macro}
%
% \begin{switch}{direct}
% The encoding aspect of a font can to a large extent be understood
% as a mapping from the set of slots to the set of glyphs---such
% mappings are for example realised by PostScript encoding vectors
% (mapping slots to glyph names) and virtual fonts (mapping slots to
% DVI commands for drawing a glyph). In some cases however, encodings
% are rather used to specify an inverse mapping going the opposite
% way. Since encodings are in general many-to-one, this means there
% need not be a proper inverse to a given encoding; instead the
% inverse image of a glyph is in practice chosen randomly\footnote{In
% the sense: according to a very deterministic (but not particularly
% useful) rule which depends completely on details in the
% implementation, and therefore should not be relied upon anyway.}
% among the slots that are mapped to it. This is not always desirable.
%
% The \texttt{direct} switch can be used to check whether an encoding
% is interpreted in the direct (slots to glyphs) or inverse (glyphs to
% slots) manner. If those |\setslot| commands which are undesirable
% under the inverse interpretation are put inside an |\ifdirect|
% \dots\ |\Fi| construction, then these will be ignored in that
% circumstance, thus allowing the programmer to exactly specify both
% the direct and the inverse mappings.
% \changes{1.924}{2003/02/08}{Command added. (LH)}
%
% In \package{fontinst}, this command is a switch, which is usually
% true.
% \begin{macrocode}
%<pkg|misc>\newif\ifdirect \directtrue
% \end{macrocode}
% In \package{fontdoc}, this is a conditional that will be typeset
% if |\showbranches| is being used.
% \begin{macrocode}
%<doc>\newcommand\ifdirect{\generic@if{direct}}
% \end{macrocode}
% \end{switch}
%
% \begin{macro}{\input_mtx_as_etx}
% The |\input_mtx_as_etx| command is syntactically similar to the
% |\inputetx| command, but it inputs an MTX file instead of an ETX
% file and redefines |\setscaledrawglyph| so that it expands to a
% |\nextslot| followed by a |\setslot| \dots\ |\endsetslot|. This is
% useful when making proofs of fonts with nonstandard encodings, as
% the MTX of a font can be used to specify ``the default encoding''
% of that font.
%
% \textbf{Warning:} Since this macro redefines a lot of the metric
% commands, you'll probably only want to call it inside a group.
% \changes{1.923}{2002/10/24}{Macro added. (LH)}
% \begin{macrocode}
%<*pkg|misc>
\def\input_mtx_as_etx#1{
\def\setscaledrawglyph##1##2##3##4##5##6##7##8##9{
\nextslot{##5}
\setslot{##1}\endsetslot
}
\offcommand\setscalednotglyph
\let\setglyph=\gobble_glyph
\offcommand\setkern
\inputmtx{#1}
}
%</pkg|misc>
% \end{macrocode}
% \end{macro}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{Metric files}
% \label{Sec:Metric files}
%
% \changes{1.911}{1999/11/17}{Definitions of metric file commands
% added to \protect\protect\protect\Module{misc}. (LH)}
%
% \DescribeMacro{\inputmtx}
% The macro
% \begin{quote}
% |\inputmtx|\marg{filename}
% \end{quote}
% inputs \meta{filename}|.mtx|, ignoring anything between |\relax| and
% |\metrics|, and anything after |\endmetrics|.
%
% \begin{macro}{\inputmtx}
% \begin{macro}{\metrics}
% \changes{1.914}{2000/05/26}{Fixed typo: \cs{x@relax} instead of
% \cs{x_relax}. (LH)}
% \usechange{raggedright}
% \begin{macro}{\endmetrics}
% \changes{1.900}{1999/02/08}{Made it outer. (LH)}
% \usechange{raggedright}
% \begin{macro}{\endmetrics_text}
% \begin{macro}{\endmetrics@hook}
% The |\endmetrics_text| macro expands to |\endmetrics| (eleven
% `other' tokens, not one control sequence token). It is used instead
% of |\string\endmetrics|, which does not work since |\endmetrics| is
% outer.
% \begin{macrocode}
%<*pkg|misc>
\def\inputmtx#1{
\def\relax{\let\relax=\x_relax\iffalse}
\let\metrics=\fi
\primitiveinput #1.mtx\x_relax
\let\relax=\x_relax
}
\let\metrics=\x_relax
\edef\endmetrics_text{\string\endmetrics}
\outer\def\endmetrics{\endinput}
%</pkg|misc>
% \end{macrocode}
% |\inputmtx| used to set |\a_count|, but we haven't been able to
% find a reason for this, so it was removed.
%
% In \package{fontdoc}, the |\metrics| and |\endmetrics| macros
% initially just define a group, but |\inputmtx| redefines them to
% work as they do in \package{fontinst}. |\endmetrics@hook| is a
% macro that gets executed just before the |\endgroup| in
% |\endmetrics|; it is normally |\@empty|, and it is set to this value
% at each |\metrics|, but the metric package system redefines it.
% \multchanges{\cs{endmetrics_hook}}{1.914}{2000/05/27}{Macro added.
% (LH)}
% \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27}
% {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)}
% \begin{macrocode}
%<*doc>
\def\inputmtx#1{%
\begingroup
\edef\lowercase@file{\lowercase{%
\edef\noexpand\lowercase@file{#1}%
}}%
\lowercase@file
\let\endmetrics@hook=\@empty
\IfFileExists{\lowercase@file.mtx}{%
\skip@mtx@preamble
\@@input \@filef@und
\let\relax=\x@relax
}{%
\PackageError{fontdoc}{File #1.mtx not found}%
{\@eha\MessageBreak You can \protect\inputmtx\space
some other file now, if you want.}%
}
\endmetrics@hook
\endgroup
}
\def\skip@mtx@preamble{%
\def\relax{\let\relax=\x@relax\iffalse}%
\let\metrics=\fi
\outer\x@cs\def{endmetrics}{\endinput}%
}
\def\metrics{%
\begin{flushleft}%
\let\endmetrics@hook=\@empty
}
\outer\def\endmetrics{%
\endmetrics@hook
\end{flushleft}%
}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
%
% \begin{macro}{\ProvidesMtxPackage}
% \changes{1.923}{2003/01/05}{Redesigned the headings for metric
% packages, since they interact poorly with \cs{section} headings.
% (LH)}
% \begin{switch}{@mtxpackage@headed@}
% \begin{macro}{\announce@package}
% \begin{macro}{\finish@package}
% \multchanges{\cs{ProvidesMtxPackage}\cs{usemtxpackage}}{1.914}
% {2000/05/27}{New \package{fontdoc} implementation---the packages
% are actually loaded (they have to, since they can define
% commands). Multiple loading is prevented as in
% \package{fontinst}. (LH)}
% The call
% \begin{quote}
% |\ProvidesMtxPackage|\marg{package~name}
% \end{quote}
% signals to the package managing system that there is no need to load
% this package again.
% \begin{macrocode}
%<pkg>\def\ProvidesMtxPackage#1{\x_cs\let{pack-#1}P}
%<*doc>
\def\ProvidesMtxPackage#1{%
\endmetrics@hook
% \@mtxpackage@headed@false
% \everypar={
\announce@package{#1}%
% }%
\def\endmetrics@hook{\finish@package{#1}}
\global\x@cs\let{FD@pack-#1}\@empty
}
% \end{macrocode}
% \begin{macrocode}
% \newif\if@mtxpackage@headed@
% \end{macrocode}
% \begin{macrocode}
\def\announce@package#1{%
% \everypar={}%
% \@mtxpackage@headed@true
\Aheading{[Start of metric package \textsf{#1}.}%
}
% \end{macrocode}
% \begin{macrocode}
\def\finish@package#1{%
% \if@mtxpackage@headed@
\Aheading{End of metric package \textsf{#1}.]}%
% \else
% \everypar={}%
% \Aheading{(Metric package \textsf{#1}.)}%
% \fi
\par\addvspace\medskipamount
}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{switch}\end{macro}
%
%
% \begin{macro}{\usemtxpackage}
% The call
% \begin{quote}
% |\usemtxpackage|\marg{package~list}
% \end{quote}
% inputs those of the packages in the list that have not been loaded
% yet (i.e., those for which no |\ProvidesMtxPackage| has been made).
% Each package is assumed to reside in the metric file that
% |\inputmtx| loads when given the name of the package as argument.
%
% The call
% \begin{quote}
% |\usemtxpackage|\oarg{filename}\marg{package~list}
% \end{quote}
% inputs the packages in the list if at least one of them has not been
% loaded yet. In this case, all the packages are assumed to reside in
% the single metric file that |\inputmtx| loads when given
% \meta{filename} as argument.
%
% \begin{macrocode}
%<*pkg>
\def\usemtxpackage{\futurelet\next_token\test_UseMtxPkg_arguments}
\def\test_UseMtxPkg_arguments{\ifx\next_token[
\expandafter\mtx_package_given_file
\else
\expandafter\mtx_package_separate_files
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\mtx_package_given_file[#1]#2{
\_a_false
\process_csep_list\load_true_unless_loaded #2,\process_csep_list,
\if_a_ \inputmtx{#1} \fi
}
\def\load_true_unless_loaded#1{
\x_cs\ifx{pack-#1}P\else\_a_true\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\mtx_package_separate_files#1{
\process_csep_list\load_file_unless_loaded #1,\process_csep_list,
}
\def\load_file_unless_loaded#1{
\x_cs\ifx{pack-#1}P\else \inputmtx{#1} \fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\usemtxpackage[2][\x@relax]{%
\ifx \x@relax#1%
\@for\@tempa:=#2\do{%
\x@cs\ifx{FD@pack-\@tempa}\@empty \else
\inputmtx{\@tempa}%
\fi
}%
\else
\@tempswafalse
\@for\@tempa:=#1\do{%
\x@cs\ifx{FD@pack-\@tempa}\@empty \else \@tempswatrue \fi
}%
\if@tempswa
\inputmtx{#2}%
\fi
\fi
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glyph_name_modifier}
% The |\glyph_name_modifier| macro is applied to all glyph names
% supplied to commands that are allowed in transformable MTX files
% (see Subsection~\ref{Ssec:TransMTX}). The syntax is
% \begin{quote}
% |\glyph_name_modifier|\marg{glyph name}
% \end{quote}
% and the above must expand fully to a valid glyph name in \TeX's
% mouth.
%
% \changes{1.923}{2002/10/20}{Macro added. (LH)}
% The normal definition is to simply expand to the \meta{glyph name},
% i.e.,
% \begin{macrocode}
%<pkg>\let\glyph_name_modifier=\identity_one
% \end{macrocode}
% but the command may expand to any sequence of character tokens. It
% was introduced to support (simple) automatic renaming of glyphs
% in cases where the |\reglyphfont| command would not be appropriate,
% such as when the wanted renaming is simply to add a short suffix to
% the glyph names.
%
% The reason it only affects the commands allowed in transformable
% MTX files is that the macro isn't meant as a generic override for
% metric commands.
% \end{macro}
%
%
% \subsection{Kerning information}
%
% The kerning information is kept in the macros
% \describecsfamily{l-\meta{name}}|\l-|\meta{name} and
% \describecsfamily{r-\meta{name}}|\r-|\meta{name}, containing
% information about how \meta{name} kerns on the left and on the right,
% respectively. The |\l-|\meta{name} macro should expand out to a
% series of
% \begin{quote}
% \DescribeMacro{\k}|\k|\,|\r-|\meta{name}\,|\|\meta{amount}
% \end{quote}
% control sequences, and vice versa. Examples of
% \describecsfamily{\meta{amount}} |\|\meta{amount}
% control sequences are: |\0|, |\1|, |\1000|, |\-50|, |\33|; these
% corresponds to the kern amounts $0$, $1$, $1000$ (which would be
% a very large kern), $-50$, and $33$ respectively.
%
%
% \begin{macro}{\setkern}
% |\setkern|\marg{glyph1}\marg{glyph2}\marg{integer expression}
%
% Sets a kern pair between \meta{glyph1} and \meta{glyph2} to the
% specified value, which is typically a value returned by
% |\kerning|\marg{glyph3}\marg{glyph4}. If there already is a kern
% set between \meta{glyph1} and \meta{glyph2} then this will not affect
% the output, but it will use up another 3 units of token memory.
%
% \begin{macrocode}
%<*pkg>
\def\setkern#1#2#3{
\x_cs\ifx{i-rawscale}\x_relax
\expandafter\set_kern
\csname~r-\glyph_name_modifier{#1}\expandafter\endcsname
\csname~l-\glyph_name_modifier{#2}\endcsname
{#3}
\else
\expandafter\set_kern
\csname~r-\glyph_name_modifier{#1}\expandafter\endcsname
\csname~l-\glyph_name_modifier{#2}\endcsname
{\scale{#3}{\int{rawscale}}}
\fi
}
\def\set_kern#1#2#3{
\eval_expr{#3}
\expandafter\set_kern_cs\csname\the\result\endcsname#1#2
}
\def\set_kern_cs#1#2#3{
\add_to#2{\k#3#1}
\add_to#3{\k#2#1}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\setkern[3]{%
\Bheading{Kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}%
${}\rightarrow \TypesetIntegerExpression{#3}$%
}
%</doc>
%<misc>\let\setkern=\gobble_three
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\resetkern}
% |\resetkern|\marg{glyph1}\marg{glyph2}\marg{integer expression}
%
% Resets the kern pair between \meta{glyph1} and \meta{glyph2} to
% the specified value. Note however that this does not relieve \TeX\
% of the burden to remember the previous kerning pair between these
% two glyphs (if there was one).
%
% \begin{macrocode}
%<*pkg>
\def\resetkern#1#2#3{
\x_cs\ifx{i-rawscale}\x_relax
\expandafter\reset_kern
\csname~r-#1\expandafter\endcsname
\csname~l-#2\endcsname{#3}
\else
\expandafter\reset_kern
\csname~r-#1\expandafter\endcsname
\csname~l-#2\endcsname{\scale{#3}{\int{rawscale}}}
\fi
}
\def\reset_kern#1#2#3{
\eval_expr{#3}
\expandafter\reset_kern_cs\csname\the\result\endcsname#1#2
}
\def\reset_kern_cs#1#2#3{
\prep_to#2{\k\expandafter#3\expandafter#1}
\prep_to#3{\k\expandafter#2\expandafter#1}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\resetkern[3]{%
\Bheading{Override kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}%
${}\rightarrow \TypesetIntegerExpression{#3}$%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setleftkerning}
% \begin{macro}{\setrightkerning}
% \begin{macro}{\setleftrightkerning}
% |\setleftkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\
% |\setrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\
% |\setleftrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}
%
% Sets left or right kerning of \meta{glyph1} to that of \meta{glyph2}
% scaled by \meta{scaled} (which is an integer expression).
% |\setleftrightkerning| does both.
%
% \begin{macrocode}
%<*pkg>
\def\setleftkerning#1#2#3{
\eval_expr_to\b_count{#3}
\expandafter\set_kerning
\csname~l-#1\expandafter\endcsname
\csname~l-#2\endcsname
}
\def\setrightkerning#1#2#3{
\eval_expr_to\b_count{#3}
\expandafter\set_kerning
\csname~r-#1\expandafter\endcsname
\csname~r-#2\endcsname
}
\def\setleftrightkerning#1#2#3{
\eval_expr_to\b_count{#3}
\expandafter\set_kerning
\csname~l-#1\expandafter\endcsname
\csname~l-#2\endcsname
\expandafter\set_kerning
\csname~r-#1\expandafter\endcsname
\csname~r-#2\endcsname
}
\def\set_kerning#1#2{
\if\b_count=\one_thousand
\def\k##1##2{
\set_kern_cs##2##1#1
}
\else
\def\k##1##2{
\set_kern##1#1{
\scale\b_count{\expandafter\gobble_one\string##2}
}
}
\fi
#2
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\setleftkerning[3]{%
\Bheading{Kern} \typeset@glyph{#1} on the left like
\typeset@glyph{#2} \ConditionallyScaled{#3}}
\newcommand\setrightkerning[3]{%
\Bheading{Kern} \typeset@glyph{#1} on the right like
\typeset@glyph{#2} \ConditionallyScaled{#3}}
\newcommand\setleftrightkerning[3]{%
\Bheading{Kern} \typeset@glyph{#1} on the left and right like
\typeset@glyph{#2} \ConditionallyScaled{#3}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ConditionallyScaled}
% \changes{1.916}{2001/01/06}{Command added. (LH)}
% Several metric commands have take a scaling factor argument which is
% rendered by \package{fontdoc} as ``scaled \meta{argument}''. The by
% far most common value for this argument is however the constant
% number 1000 (no scaling), and in those cases the ``scaled
% \textellipsis'' feels a bit long-winded. The cure for this is the
% |\Conditionally|\-|Scaled| command, which takes an integer expression
% as its argument and typesets the ``scaled \meta{integer expression}''
% \emph{unless} that expression evaluates to 1000, in which case
% |\Conditionally|\-|Scaled| simply gobbles any spaces following it.
% \begin{macrocode}
\newcommand\ConditionallyScaled[1]{%
\FD@evaluate@true
\FD@eval@expr{#1}%
\@tempswatrue
\ifFD@evaluate@ \ifnum \FD@result=\@m \@tempswafalse \fi\fi
\FD@evaluate@false
\if@tempswa scaled \(\FD@expression\)\else \ignorespaces \fi
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\kerning}
% |\kerning|\marg{glyph1}\marg{glyph2}
%
% Returns the value of kern pair between \meta{glyph1} and
% \meta{glyph2} as an integer. Returns a value of zero if such a kern
% pair doesn't exist.
%
% \begin{macrocode}
%<*pkg>
\def\kerning#1#2{0\x_relax
\def\k##1{\csname~set-\string##1\endcsname\gobble_one}
\bgroup
\x_cs\def{set-\string\l-#2}##1##2{
\global\result=\expandafter\gobble_one\string##2\egroup
}
\csname~r-#1\endcsname
\csname~set-\string\l-#2\endcsname\gobble_one{00}
}
%</pkg>
% \end{macrocode}
% \changes{1.909}{1999/10/19}{A use of \#1 where it should have
% been \#2 was corrected. (LH)}
% \begin{macrocode}
%<*doc>
\DeclareRobustCommand\kerning[2]{%
\begingroup
\MakePrintable\@tempa{FD@swa}{#1}%
\MakePrintable\@tempb{FD@swa}{#2}%
\protected@xdef\FD@expression{%
\mathop{\protect\mathrm{k{}}}(%
\text{\protect\FD@typeset@string{\@tempa}}%
,\penalty\FD@commapenalty
\text{\protect\FD@typeset@string{\@tempb}}%
)%
}%
\global\chardef\FD@priority=5%
\global\FD@bracket@level=\@ne
\FD@evaluate@false
\endgroup
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifiskern}
% |\ifiskern|\marg{glyph1}\marg{glyph2}|\then|
%
% This command tests if there is a kern pair between \meta{glyph1} and
% \meta{glyph2}. It's hard to say if there is a use for it, but it is
% included for symmetry.
%
% \begin{macrocode}
%<*pkg>
\def\ifiskern#1#2\then{
\def\k##1##2{\ifx T##1 \let\k\gobble_two \fi}
\bgroup
\x_cs\let{l-#2}T
\csname r-#1\endcsname
\expandafter\egroup \ifx\k\gobble_two
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\def\ifiskern#1#2\then{%
\generic@if{kern \typeset@glyph{#1}${}+{}$\typeset@glyph{#2} set}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\unsetkerns}
% |\unsetkerns|\marg{left~glyph~list}\marg{right~glyph~list}
%
% This command unsets all kerns with a glyph in the \meta{left~glyph~list}
% on the left and a glyph in the \meta{right~glyph~list} on the right.
% The lists themselves are ordinary comma-separated lists. Unlike
% |\setkern| and |\resetkern|, |\unsetkerns| actually removes the
% kerning pairs from \TeX's memory.
%
% The implementation itself simply goes through |\r-|\meta{left~glyph}
% for each element \meta{left~glyph} in \meta{left~glyph~list} and
% |\l-|\meta{right~glyph} for each element \meta{right~glyph} in
% \meta{right~glyph~list}, removing each |\k|\meta{token}\meta{token}
% tripple that refers to a glyph from the opposite list as it goes
% along. To make this test reasonably fast, the routine first ``marks''
% the glyphs in the other list by setting the control sequences
% |\slots-|\meta{glyph} to |U| (the letter token U). This mark is
% later removed when the |\r-|\meta{glyph} or |\l-|\meta{glyph}
% respectively control sequences have been gone through; the
% |\slots-|\meta{glyph} control sequences are then set to |\relax|.
%
% \begin{macrocode}
%<*pkg>
\def\unsetkerns#1#2{
\let\k\k_unless_to_U
\process_csep_list\make_slots_U#1,\process_csep_list,
\def\do##1{\x_cs\main_remove_Us{l-##1}}
\process_csep_list\do#2,\process_csep_list,
\process_csep_list\make_slots_relax#1,\process_csep_list,
\process_csep_list\make_slots_U#2,\process_csep_list,
\def\do##1{\x_cs\main_remove_Us{r-##1}}
\process_csep_list\do#1,\process_csep_list,
\process_csep_list\make_slots_relax#2,\process_csep_list,
}
\def\make_slots_U#1{\x_cs\let{slots-#1}U}
\def\make_slots_relax#1{\x_cs\let{slots-#1}\x_relax}
\def\k_unless_to_U#1#2{
\x_cs\ifx{slots-\expandafter\gobble_three\string#1}U \else
\noexpand\k\noexpand#1\noexpand#2
\fi
}
\def\main_remove_Us#1{
\ifx#1\x_relax \else
\edef#1{#1}
\ifx#1\empty_command \let#1\x_relax \fi
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\unsetkerns[2]{%
\Bheading{Remove} all kerning pairs in
\FD@typeset@string@set{#1}${}\times{}$\FD@typeset@string@set{#2}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FD@typeset@string@set}
% \begin{macro}{\FD@typeset@string@set@}
% \multchanges{\cs{FD@typeset@string@set}^^A
% \cs{FD@typeset@string@set@}}{1.916}{2001/01/02}{Macros added.
% \cs{FD@typeset@string@set} should be used instead of
% \cs{print@csep@list} in most occations. (LH)}
% The |\FD@typeset@string@set| macro takes a comma-separated list of
% string expressions as argument and typesets that list as elements of
% a set, e.g.
% \begin{quote}
% |\FD@typeset@string@set{a,b,\str{c}}|
% \end{quote}
% is typeset as
% \begin{quote}
% $\{$\texttt{a}$,{}$\texttt{b}$,\mathrm{s}($\texttt{c}$)\}$
% \end{quote}
% \begin{macrocode}
\def\FD@typeset@string@set#1{%
\toks@={}%
\@for\@tempa:=#1\do{%
\protected@edef\@tempa{%
\noexpand\MakePrintable \noexpand\@tempa {FD@swa}{\@tempa}%
}%
\@tempa
\toks@=\expandafter{\the\expandafter\toks@
\expandafter\do \expandafter{\@tempa}}%
}%
\expandafter\FD@typeset@string@set@ \expandafter{\the\toks@}%
}
\def\FD@typeset@string@set@#1{%
\TypesetList{$\{$}{$,\penalty\FD@commapenalty{}$}%
{$,\penalty\FD@commapenalty{}$}{$,\penalty\FD@commapenalty{}$}%
{$\}$}{$\emptyset$}{\FD@typeset@string}{#1}%
}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}
%
%
% \begin{macro}{\noleftkerning}
% \changes{1.906}{1999/07/30}{Macro added. (LH)}
% \begin{macro}{\norightkerning}
% \changes{1.906}{1999/07/30}{Macro added. (LH)}
% \begin{macro}{\noleftrightkerning}
% \changes{1.906}{1999/07/30}{Macro added. (LH)}
% The argument of these commands is the name of a glyph. The commands
% removes all kerns on the left, on the right, and on both sides
% respectively, of this glyph.
%
% \begin{macrocode}
%<*pkg>
\def\noleftkerning#1{\no_kerning{l}{#1}}
\def\norightkerning#1{\no_kerning{r}{#1}}
\def\noleftrightkerning#1{\no_kerning{l}{#1}\no_kerning{r}{#1}}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\noleftkerning[1]{%
\Bheading{Remove kerns} on the left of glyphs in
\FD@typeset@string@set{#1}.}
\newcommand\norightkerning[1]{%
\Bheading{Remove kerns} on the right of glyphs in
\FD@typeset@string@set{#1}.}
\newcommand\noleftrightkerning[1]{%
\Bheading{Remove kerns} on any side of glyphs in
\FD@typeset@string@set{#1}.}
%</doc>
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\no_kerning}
% \changes{1.906}{1999/07/30}{Macro added. (LH)}^^A
% \changes{1.906}{1999/08/01}{Macro thoroughly rewritten. (LH)}^^A
% This macro is called as
% \begin{quote}
% |\no_kerning|\marg{side}\marg{glyph list}
% \end{quote}
% where \meta{side} is |l| or |r|, and \meta{glyph list} is a
% comma-separated list of glyph names. The macro unsets all kerns on
% the \meta{side} side of the glyphs in the \meta{glyph list}.
%
% \begin{macrocode}
%<*pkg>
\def\no_kerning#1#2{
\let\k\no_kerning_i
\def\do##1{\csname #1-##1\endcsname}
\bgroup
\aftergroup\def \aftergroup\a_macro \aftergroup{
\process_csep_list\do #2,\process_csep_list,
\aftergroup}
\egroup
\def\do##1{\expandafter\let \csname #1-##1\endcsname \x_relax}
\process_csep_list\do #2,\process_csep_list,
\let\k\no_kerning_ii
\def\do##1{\edef##1{##1}}
\a_macro
}
% \end{macrocode}
% \begin{macro}{\no_kerning_i}
% The |\no_kerning_i| macro is used by |\no_kerning| in constructing
% a list of all glyphs that a glyph in the \meta{glyph list} has a
% \meta{side} kern to, while avoiding repetitions.
% \begin{macrocode}
\def\no_kerning_i#1#2{
\ifx #1\x_relax \else
\aftergroup\do \aftergroup#1
\let #1\x_relax
\fi
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\no_kerning_ii}
% The |\no_kerning_ii| macro is similar to the |\k_unless_to_U|
% macro.
% \begin{macrocode}
\def\no_kerning_ii#1#2{
\ifx #1\x_relax \else \noexpand\k \noexpand#1 \noexpand#2 \fi
}
%</pkg>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%
% \subsection{Glyph information}
% \label{Ssec:Glyph-info}
%
% The glyph information is kept in the macros
% \describecsfamily{g-\meta{name}}|\g-|\meta{name}, which expands
% out to:
% \begin{quote}
% \marg{width}\marg{height}\marg{depth}\marg{italic}^^A
% \marg{mapcommands}\marg{mapfonts}
% \end{quote}
% where the \meta{mapcommands} will write out VPL |MAP| fragments to a
% |.vpl| file, and the \meta{mapfonts} will produce any |MAPFONT|
% instructions that are needed.
%
%
% \begin{macro}{\typeset@glyph}
% \changes{1.909}{1999/10/20}{Macro added, and most commands that
% print a glyph name changed to use this macro. (LH)}
% \changes{1.916}{2001/01/02}{Macro redefined (made synonymous to
% \cs{Typeset\-String\-Expression}). (LH)}
% The |\typeset@glyph| macro takes a string expression and typesets
% that as the name of a glyph. Currently names of glyphs are formatted
% precisely the same as any other string expression.
% \begin{macrocode}
%<doc>\let\typeset@glyph=\TypesetStringExpression
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\width}
% \begin{macro}{\height}
% \begin{macro}{\depth}
% \begin{macro}{\italic}
% |\width|\marg{glyph}\\
% |\height|\marg{glyph}\\
% |\depth|\marg{glyph}\\
% |\italic|\marg{glyph}
%
% In \package{fontinst}, these macros return the width, height,
% depth, and italic correction of \meta{glyph} as an integer.
% \begin{macrocode}
%<*pkg>
\def\width{\glyph_parameter\first_of_six}
\def\height{\glyph_parameter\second_of_six}
\def\depth{\glyph_parameter\third_of_six}
\def\italic{\glyph_parameter\fourth_of_six}
%</pkg>
% \end{macrocode}
%
% In \package{fontdoc}, they print symbolic representations for the
% corresponding integer expressions.
% \begin{macrocode}
%<*doc>
\DeclareRobustCommand\width[1]{\FD@glyph@metric{w}{#1}}
\DeclareRobustCommand\height[1]{\FD@glyph@metric{h}{#1}}
\DeclareRobustCommand\depth[1]{\FD@glyph@metric{d}{#1}}
\DeclareRobustCommand\italic[1]{\FD@glyph@metric{i}{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FD@glyph@metric}
% The |\FD@glyph@metric| macro is a convenient shorthand to use when
% defining integer-valued functions which represents some glyph
% metric (e.g.\ \cs{height}). Its syntax is
% \begin{quote}
% |\FD@glyph@metric|\marg{func-name}\marg{string expression}
% \end{quote}
% The \meta{string expression} must be expanded.
% \begin{macrocode}
\def\FD@glyph@metric#1#2{%
\begingroup
\MakePrintable\@tempa{FD@swa}{#2}%
\protected@xdef\FD@expression{%
\protect\FD@integer@func{#1}{\@tempa}%
}%
\global\chardef\FD@priority=5%
\global\FD@bracket@level=\@ne
\FD@evaluate@false
\endgroup
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\mapcommands}
% \begin{macro}{\mapfonts}
% These are similar to |\width| and its companions, but they are not
% user level commands.
% \begin{macrocode}
%<*pkg>
\def\mapcommands{\glyph_parameter\fifth_of_six}
\def\mapfonts{\glyph_parameter\sixth_of_six}
%</pkg>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\glyph_parameter}
% \begin{macro}{\first_of_six}
% \begin{macro}{\second_of_six}
% \begin{macro}{\third_of_six}
% \begin{macro}{\fourth_of_six}
% \begin{macro}{\fifth_of_six}
% \begin{macro}{\sixth_of_six}
% \begin{macro}{\glyph_metrics}
% These macros are used to define |\width| and its friends.
% |\glyph_parameter| takes one of the other seven for its first
% argument and a glyph name for its second argument. The
% |\glyph_metrics| macro can be used if one wants to get all the
% metric variables at once.
% \begin{macrocode}
%<*pkg>
\def\glyph_parameter#1#2{
\expandafter\expandafter\expandafter
#1\csname g-#2\endcsname
}
% \end{macrocode}
% \begin{macrocode}
\def\first_of_six#1#2#3#4#5#6{#1}
\def\second_of_six#1#2#3#4#5#6{#2}
\def\third_of_six#1#2#3#4#5#6{#3}
\def\fourth_of_six#1#2#3#4#5#6{#4}
\def\fifth_of_six#1#2#3#4#5#6{#5}
\def\sixth_of_six#1#2#3#4#5#6{#6}
% \end{macrocode}
% \begin{macrocode}
\def\glyph_metrics#1#2#3#4#5#6{
\a_count=#1
\b_count=#2
\c_count=#3
\d_count=#4~
}
% \end{macrocode}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
% \end{macro} \end{macro} \end{macro}
%
%
% \begin{macro}{\saved_scale}
% \begin{macro}{\saved_mapfont}
% \begin{macro}{\saved_raw}
% \begin{macro}{\saved_rule}
% \begin{macro}{\saved_special}
% \begin{macro}{\saved_warning}
% \begin{macro}{\saved_movert}
% \begin{macro}{\saved_moveup}
% \begin{macro}{\saved_push}
% \begin{macro}{\saved_pop}
% These are the commands allowed inside a glyph. They are initally
% set to |\relax|, so we can |\edef| with them safely.
% \begin{macrocode}
\let\saved_scale\x_relax
\let\saved_mapfont\x_relax
\let\saved_raw\x_relax
\let\saved_rule\x_relax
\let\saved_special\x_relax
\let\saved_warning\x_relax
\let\saved_movert\x_relax
\let\saved_moveup\x_relax
\let\saved_push\x_relax
\let\saved_pop\x_relax
% \end{macrocode}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
%
% When the glyph is being constructed by
% \begin{quote}
% |\setglyph|\marg{glyph} \meta{glyph commands} |\endsetglyph|
% \end{quote}
% the values of each of these parameters are kept in the following
% variables. Except for |\glyph_width|, these are kept globally,
% so they survive through |\push| \textellipsis\ |\pop| pairs. In
% addition, the current vertical offset is kept locally in
% |\glyph_voffset|. The |\glyph_maxhpos| variable globally keeps track
% of the largest horizontal offset position reached so far (with the
% possible exception of the current position, i.e.\ width, which may
% well be larger).
%
%
% \begin{macro}{\glyph_width}
% \begin{macro}{\glyph_height}
% \begin{macro}{\glyph_depth}
% \begin{macro}{\glyph_italic}
% \begin{macro}{\glyph_map_commands}
% \begin{macro}{\glyph_map_fonts}
% \begin{macro}{\glyph_voffset}
% \begin{macro}{\glyph_maxhpos}
% \changes{1.903}{1999/05/20}{Variable added. (LH)}
% \begin{macrocode}
\newcount\glyph_width
\newcount\glyph_height
\newcount\glyph_depth
\newcount\glyph_italic
\newtoks\glyph_map_commands
\newtoks\glyph_map_fonts
\newcount\glyph_voffset
\newcount\glyph_maxhpos
% \end{macrocode}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
% \end{macro} \end{macro} \end{macro}
%
% \begin{macro}{\setglyph}
% \changes{1.916}{2001/01/06}{Added `set' to \package{fontdoc} text.
% (LH)}
% \begin{macro}{\gobble_glyph}
% The |\setglyph|\marg{name} command defines |\g-|\meta{name},
% unless |\g-|\meta{name} has already been defined.
%
% The reason |\g-|\meta{name} is defined before calling |\resetglyph|
% is to make it possible to refer to ``the glyph constructed so far''
% using |\width|\marg{name}, |\height|\marg{name}, etc.
% \begin{macrocode}
\def\setglyph#1{
\ifisglyph{\glyph_name_modifier{#1}}\then
\expandafter\gobble_glyph
\else
\x_cs\def{g-\glyph_name_modifier{#1}}{
{\the\glyph_width}{\the\glyph_height}
{\the\glyph_depth}{\the\glyph_italic}
{\the\glyph_map_commands}{\the\glyph_map_fonts}
}
\resetglyph{\glyph_name_modifier{#1}}
\fi
}
\long\def\gobble_glyph#1\endsetglyph{}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\setglyph[1]{%
\FD@tight@true
\Aheading{Set glyph `\typeset@glyph{#1}'}%
}
%</doc>
%<misc>\long\def\setglyph#1\endsetglyph{}
% \end{macrocode}
%
% LH 2003/01/05: A very useful trick, which unfortunately used to be
% undocumented, is to put kerning or variable assignment commands
% between |\setglyph| and the corresponding |\endsetglyph|. These
% commands will then only be executed if the glyph is being set by
% that |\setglyph|. Typical application: If \texttt{Aacutesmall}
% is being made by skrinking \texttt{Aacute}, then it is reasonable
% to make \texttt{Aacutesmall} kern like \texttt{Aacute} (modulo
% some scaling factor). If on the other hand \texttt{Aacutesmall}
% has already been set then there is less reason to believe
% \texttt{Aacutesmall} should kern like \texttt{Aacute} (a more
% probable guess is that it should kern like \texttt{Asmall}).
% \end{macro} \end{macro}
%
% \begin{macro}{\resetglyph}
% The |\resetglyph|\marg{name} command redefines |\g-|\meta{name},
% regardless of whether |\g-|\meta{name} has already been defined.
% \changes{1.923}{2002/10/20}{\cs{edef}ing \cs{glyphname}, for
% consistency with \cs{setslot}. In principle, this could break
% MTX files, but I doubt that it will. (LH)}
%
% \begin{macrocode}
%<*pkg>
\def\resetglyph#1{
\edef\glyphname{#1}
\glyph_width=0
\global\glyph_height=0
\global\glyph_depth=0
\global\glyph_italic=0
\glyph_voffset=0
\global\glyph_maxhpos=0
\global\glyph_map_commands={}
\global\glyph_map_fonts={}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\resetglyph[1]{%
\FD@tight@true
\Aheading{Reset glyph `\typeset@glyph{#1}'}}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endsetglyph}
% \begin{macro}{\endresetglyph}
% \begin{macrocode}
%<*pkg>
\def\endsetglyph{
\x_cs\edef{g-\glyphname}
{{\the\glyph_width}{\the\glyph_height}
{\the\glyph_depth}{\the\glyph_italic}
{\the\glyph_map_commands}{\the\glyph_map_fonts}}
}
\let\endresetglyph=\endsetglyph
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\let\endsetglyph=\FD@tight@false
\let\endresetglyph=\FD@tight@false
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\setscaledrawglyph}
% \changes{1.922}{2002/09/07}{Corrected typo: should test whether the
% \texttt{rawscale} integer exists, not whether the
% \texttt{i-rawscale} integer exists. (LH)}
% \begin{macro}{\setrawglyph}
% The |\setscaledrawglyph| has the syntax
% \begin{isyntax}
% |\setscaledrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A
% \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0
% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
% \end{isyntax}
% It is a generalized form of the old |\setrawglyph| command, which
% has the syntax
% \begin{isyntax}
% |\setrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A
% \marg{slot}\penalty0\marg{width}\penalty0
% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
% \end{isyntax}
% |\setrawglyph| is now syntactic sugar for the equivalent call of
% |\set|\-|scaled|\-|raw|\-|glyph|.
% \begin{macrocode}
%<*pkg>
\def\setrawglyph#1#2#3{
\setscaledrawglyph{#1}{#2}{#3}\one_thousand
}
% \end{macrocode}
%
% These commands are generated automatically, when an |.mtx| file is
% written out by |\afmtomtx|, |\pltomtx|, or |\mtxtomtx|.
%
% To illustrate the difference between |\setrawglyph| and the new
% |\set|\-|scaled|\-|raw|\-|glyph|, note that
% \begin{quote}
% |\setscaledrawglyph{fscaled}{xfont}{10pt}{800}{102}%|\\
% | {300}{600}{300}{40}|
% \end{quote}
% produces the same \texttt{fscaled} glyph as
% \begin{quote}
% |\setrawglyph{f}{xfont}{10pt}{102}{375}{750}{375}{50}|\\
% |\setglyph{fscaled} \glyph{f}{800} \endsetglyph|
% \end{quote}
%
% \begin{macrocode}
\def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{
\if_undefined{g-\glyph_name_modifier{#1}}\then
\eval_expr{#4}
\ifnum \result=\one_thousand
\let\a_macro\identity_one
\else
\edef\a_macro##1{\saved_scale{\the\result}{##1}}
\fi
\eval_expr_to\a_count{#6}
\eval_expr_to\b_count{#7}
\eval_expr_to\c_count{#8}
\eval_expr_to\d_count{#9}
\ifisint{rawscale}\then
\e_count=\int{rawscale}
\multiply \a_count \e_count \l_rounded_thousandths\a_count
\multiply \b_count \e_count \l_rounded_thousandths\b_count
\multiply \c_count \e_count \l_rounded_thousandths\c_count
\multiply \d_count \e_count \l_rounded_thousandths\d_count
\edef\a_macro##1{\saved_scale{\the\e_count}{\a_macro{##1}}}
\fi
\x_cs\edef{g-\glyph_name_modifier{#1}}{
{\the\a_count}
{\the\b_count}
{\the\c_count}
{\the\d_count}
{\a_macro{\saved_raw{#2}{#5}{#1}}}
{\a_macro{\saved_mapfont{#2}{#3}}}
}
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\setrawglyph[8]{%
\Aheading{Glyph `\typeset@glyph{#1}'}
\Bheading{Taken from} slot $\TypesetIntegerExpression{#4}$ in
font \TypesetStringExpression{#2}%
}
\newcommand\setscaledrawglyph[9]{%
\Aheading{Glyph `\typeset@glyph{#1}'}
\Bheading{Taken from} slot $\TypesetIntegerExpression{#5}$ in
font \TypesetStringExpression{#2} \ConditionallyScaled{#4}%
}
%</doc>
%<misc>\def\setrawglyph#1#2#3#4#5#6#7#8{}
%<misc>\def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{}
% \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\setscalednotglyph}
% \changes{1.917}{2001/03/13}{This macro should set
% \cs{g-\meta{glyph}-not}, not \cs{g-\meta{glyph}}. (LH)}
% \changes{1.922}{2002/09/07}{Corrected typo: should test whether
% the \texttt{rawscale} integer exists, not whether the
% \texttt{i-rawscale} integer exists. (LH)}
% \begin{macro}{\setnotglyph}
% The |\setscalednotglyph| command has the same syntax as the
% |\set|\-|scaled|\-|raw|\-|glyph| command, i.e.,
% \begin{isyntax}
% |\setscalednotglyph|\marg{glyph}\marg{font}\marg{design size}^^A
% \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0
% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
% \end{isyntax}
% It is a generalized form of the old |\setnotglyph| command, which
% has the syntax
% \begin{isyntax}
% |\setnotglyph|\marg{glyph}\marg{font}\marg{design size}^^A
% \marg{slot}\penalty0\marg{width}\penalty0\marg{height}\penalty0
% \marg{depth}\penalty0\marg{italic}
% \end{isyntax}
% |\setnotglyph| is now syntactic sugar for the equivalent call of
% |\set|\-|scaled|\-|not|\-|glyph|.
% \begin{macrocode}
%<*pkg>
\def\setnotglyph#1#2#3{
\setscalednotglyph{#1}{#2}{#3}\one_thousand
}
% \end{macrocode}
%
% Note that only the \meta{glyph}, \meta{width}, \meta{height},
% \meta{depth}, and \meta{italic} parameters are used. The reason for
% having the other parameters is that |\set|\-|scaled|\-|not|\-^^A
% |glyph| commands can be converted to |\set|\-|scaled|\-|raw|\-^^A
% |glyph| commands when a font is reencoded. Therefore all the
% information must be present, even if it is not used by the main
% definition.
%
% To think about (LH 2000/03/02): Perhaps the \meta{mapcommands} field
% of a \texttt{-not}-glyph should contain a |\glyphwarning|, just in
% case anyone tries to use one?
% \begin{macrocode}
\def\setscalednotglyph#1#2#3#4#5#6#7#8#9{
\if_undefined{g-\glyph_name_modifier{#1}-not}\then
\eval_expr_to\a_count{#6}
\eval_expr_to\b_count{#7}
\eval_expr_to\c_count{#8}
\eval_expr_to\d_count{#9}
\ifisint{rawscale}\then
\e_count=\int{rawscale}
\multiply \a_count \e_count \l_rounded_thousandths\a_count
\multiply \b_count \e_count \l_rounded_thousandths\b_count
\multiply \c_count \e_count \l_rounded_thousandths\c_count
\multiply \d_count \e_count \l_rounded_thousandths\d_count
\fi
\x_cs\edef{g-\glyph_name_modifier{#1}-not}{
{\the\a_count}
{\the\b_count}
{\the\c_count}
{\the\d_count}
{}{}
}
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\setnotglyph[8]{%
\Aheading{Pseudoglyph `\typeset@glyph{#1-not}'}%
}
\newcommand\setscalednotglyph[9]{%
\setnotglyph{#1}{#2}{#3}{#5}{#6}{#7}{#8}{#9}%
}
%</doc>
%<misc>\let\setnotglyph=\setrawglyph
%<misc>\let\setscalednotglyph=\setscaledrawglyph
% \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\unsetglyph}
% The |\unsetglyph|\marg{name} command makes |\g-|\meta{name}
% undefined.
%
% \begin{macrocode}
%<pkg>\def\unsetglyph#1{\x_cs\let{g-#1}\x_relax}
%<doc>\newcommand\unsetglyph[1]{%
%<doc> \Aheading{Unset glyph `\typeset@glyph{#1}'}}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Glyph commands}
%
% The \meta{glyph commands} are:
% \changes{1.908}{1999/08/22}{Glyph commands avoid \cs{edef}ing old
% contents of \cs{glyph_map_commands} and \cs{glyph_map_fonts}. (LH)}
% \begin{macro}{\glyph}
% |\glyph|\marg{glyph}\marg{scale}
% \changes{1.900}{1999/02/08}{Avoids scaling by 1000. (LH)}
%
% \begin{macrocode}
%<*pkg>
\def\glyph#1#2{
\glyph_parameter\glyph_metrics{#1}
\eval_expr_to\e_count{#2}
\ifnum \e_count=\one_thousand
\edef\a_macro{\mapcommands{#1}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
\edef\a_macro{\mapfonts{#1}}
\else
\multiply \a_count \e_count \l_rounded_thousandths\a_count
\multiply \b_count \e_count \l_rounded_thousandths\b_count
\multiply \c_count \e_count \l_rounded_thousandths\c_count
\multiply \d_count \e_count \l_rounded_thousandths\d_count
\edef\a_macro{\saved_scale{\the\e_count}{\mapcommands{#1}}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
\edef\a_macro{\saved_scale{\the\e_count}{\mapfonts{#1}}}
\fi
\advance \glyph_width \a_count
\advance \b_count \glyph_voffset
\ifnum \glyph_height<\b_count \global\glyph_height=\b_count \fi
\advance \c_count -\glyph_voffset
\ifnum \glyph_depth<\c_count \global\glyph_depth=\c_count \fi
\global\glyph_italic=\d_count
\global\glyph_map_fonts\expandafter{
\the\expandafter\glyph_map_fonts \a_macro
}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\glyph[2]{%
\Bheading{Glyph} `\typeset@glyph{#1}' \ConditionallyScaled{#2}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glyphrule}
% |\glyphrule|\marg{width}\marg{height}
%
% \begin{macrocode}
%<*pkg>
\def\glyphrule#1#2{
\eval_expr_to\b_count{#1} \eval_expr_to\c_count{#2}
\advance\glyph_width by \b_count
\g_eval_expr_to\glyph_depth{\max\glyph_depth{-\glyph_voffset}}
\g_eval_expr_to\glyph_height{
\max\glyph_height{\add\glyph_voffset\c_count}
}
\global\glyph_italic=0
\edef\a_macro{\saved_rule{\the\b_count}{\the\c_count}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\glyphrule[2]{%
\Bheading{Rule} $\TypesetIntegerExpression{#1}$ by
$\TypesetIntegerExpression{#2}$%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glyphspecial}
% \begin{macro}{\glyphwarning}
% |\glyphspecial|\marg{string}\\
% |\glyphwarning|\marg{string}
%
% \begin{macrocode}
%<*pkg>
\def\glyphspecial#1{
\edef\a_macro{\saved_special{#1}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
}
\def\glyphwarning#1{
\edef\a_macro{\saved_warning{#1}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\glyphspecial[1]{%
\Bheading{Special} `\TypesetStringExpression{#1}'}
\newcommand\glyphwarning[1]{%
\Bheading{Warning} `\TypesetStringExpression{#1}'}
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\movert}
% \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)}
% \begin{macro}{\moveup}
% |\movert|\marg{xoffset}\\
% |\moveup|\marg{yoffset}
%
% \begin{macrocode}
%<*pkg>
\def\movert#1{
\eval_expr{#1}
\ifnum \glyph_maxhpos<\glyph_width
\global\glyph_maxhpos\glyph_width
\fi
\ifnum 0=\result \else
\advance\glyph_width by \result
\edef\a_macro{\saved_movert{\the\result}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\moveup#1{
\eval_expr{#1}
\ifnum\result=0\else
\advance\glyph_voffset by \result
\edef\a_macro{\saved_moveup{\the\result}}
\global\glyph_map_commands\expandafter{
\the\expandafter\glyph_map_commands \a_macro
}
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\movert[1]{\Bheading{Rt}~$\TypesetIntegerExpression{#1}$}
\newcommand\moveup[1]{\Bheading{Up}~$\TypesetIntegerExpression{#1}$}
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\push}
% \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)}
% \begin{macro}{\pop}
% \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)}
% \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)}
% \begin{macrocode}
%<*pkg>
\def\push{
\bgroup
\global\glyph_map_commands\expandafter{
\the\glyph_map_commands \saved_push
}
}
% \end{macrocode}
% \begin{macrocode}
\def\pop{
\ifnum \glyph_maxhpos<\glyph_width
\global\glyph_maxhpos\glyph_width
\fi
\egroup
\global\glyph_map_commands\expandafter{
\the\glyph_map_commands \saved_pop
}
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\push{\Bheading{Push}}
\newcommand\pop{\Bheading{Pop}}
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\resetwidth}
% \begin{macro}{\resetheight}
% \begin{macro}{\resetdepth}
% \begin{macro}{\resetitalic}
% |\resetwidth|\marg{width}\\
% |\resetheight|\marg{height}\\
% |\resetdepth|\marg{depth}\\
% |\resetitalic|\marg{italic}
%
% \begin{macrocode}
%<*pkg>
\def\resetwidth#1{\movert{\sub{#1}\glyph_width}}
\def\resetheight{\g_eval_expr_to\glyph_height}
\def\resetdepth{\g_eval_expr_to\glyph_depth}
\def\resetitalic{\g_eval_expr_to\glyph_italic}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\resetwidth[1]{%
\Bheading{Reset width to $\TypesetIntegerExpression{#1}$}%
}
\newcommand\resetheight[1]{%
\Bheading{Reset height to $\TypesetIntegerExpression{#1}$}%
}
\newcommand\resetdepth[1]{%
\Bheading{Reset depth to $\TypesetIntegerExpression{#1}$}%
}
\newcommand\resetitalic[1]{%
\Bheading{Reset italic to $\TypesetIntegerExpression{#1}$}%
}
%</doc>
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\glyphpcc}
% Some syntactic sugar: |\glyphpcc| could do with optimization.
% \begin{quote}
% |\glyphpcc|\marg{glyph}\marg{xoffset}\marg{yoffset}
% \end{quote}
% \changes{1.925}{2003/05/28}{Added check that the glyph used is
% defined; we get an ugly error if it isn't. (LH)}
%
% \begin{macrocode}
%<*pkg>
\def\glyphpcc#1#2#3{
\ifisglyph{\glyph_name_modifier{#1}}\then
\push
\movert{#2}
\moveup{#3}
\glyph{\glyph_name_modifier{#1}}{\one_thousand}
\pop
\else
\fontinsterror{\string\glyphpcc}{
Base~glyph~not~set.\messagebreak
This~could~be~a~sign~that~the~AFM~file~is~buggy
}\error_help_a
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\def\glyphpcc#1#2#3{
\push
\movert{#2}
\moveup{#3}
\glyph{#1}{1000}
\pop
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glyphbboxright}
% \changes{1.903}{1999/05/20}{Macro added. (LH)}
% The |\glyphbboxright| command is a valid integer expression, but
% its value is only meaningful inside a |\setglyph| \textellipsis\
% |\endsetglyph| or |\resetglyph| \textellipsis\ |\endresetglyph|
% structure. There its value is almost the horizontal position of
% the right edge of the bounding box for the glyph constructed so
% far---in reality it is the greatest horizontal offset reached so
% far.
%
% \begin{macrocode}
%<pkg>\def\glyphbboxright{\max\glyph_width\glyph_maxhpos}
%<*doc>
\DeclareRobustCommand\glyphbboxright{%
\gdef\FD@expression{\protect\mathrm{glyphbboxright}}
\global\chardef\FD@priority=\tw@
\global\FD@bracket@level=\z@
\FD@evaluate@false
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\samesize}
% \changes{1.903}{1999/05/20}{Added behaviour for nonexistent glyph
% (based on a suggestion from Hilmar Schlegel) and fixed typo in
% \package{fontdoc}. (LH)}
% |\samesize|\marg{glyph}
%
% \begin{macrocode}
%<*pkg>
\def\samesize#1{
\if_undefined{g-\glyph_name_modifier{#1}}\then
\resetwidth{\glyphbboxright}
\else
\expandafter\expandafter\expandafter
\same_size\csname g-\glyph_name_modifier{#1}\endcsname
\fi
}
\def\same_size#1#2#3#4#5#6{
\movert{\sub{#1}\glyph_width}
\global\glyph_height=#2
\global\glyph_depth=#3
\global\glyph_italic=#4
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\newcommand\samesize[1]{%
\Bheading{Reset dimensions to those of `\typeset@glyph{#1}'.}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifisglyph}
% The control flow command:
% \changes{1.923}{2002/10/20}{Using \cs{if_defined}. (LH)}
% \begin{macrocode}
%<pkg>\def\ifisglyph#1\then{\if_defined{g-#1}\then}
% \end{macrocode}
% \changes{1.911}{1999/11/30}{\protect\protect\protect\Module{misc}
% definition added. (LH)}
% |\ifisglyph| evaluates to false in \Module{misc}, since this avoids
% uses of various metric integer expressions (such as |\width|,
% |\height|, etc.) that are not defined there.
% \begin{macrocode}
%<doc>\def\ifisglyph#1\then{\generic@if{glyph \typeset@glyph{#1} set}}
%<misc>\def\ifisglyph#1\then{\iffalse}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifareglyphs}
% \changes{1.917}{2001/03/17}{Macro added. (LH)}
% The |\ifareglyphs| command test if all glyphs in a comma-separeted
% list of glyphs are set. The syntax is
% \begin{quote}
% |\ifareglyphs|\marg{glyph list}|\then|
% \end{quote}
% The implementation relies on that |\if_true| and |\if_false| do not
% count when \TeX\ is skipping text that is balanced with respect to
% |\if|s and |\fi|s.
% \begin{macrocode}
%<*pkg>
\def\ifareglyphs#1\then{
\process_csep_list{\if_is_glyph}#1,\process_csep_list,
\if_true
}
\def\if_is_glyph#1{
\if_undefined{g-#1}\then \expandafter\if_false \fi
}
%</pkg>
%<misc>\let\ifareglyphs=\ifisglyph
%<*doc>
\def\ifareglyphs#1\then{%
\generic@if{all glyphs in \FD@typeset@string@set{#1} are set}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{Converting an ETX file to a (V)PL file}
%
% \subsection{Lowest-level user interface}
%
% \DescribeMacro{\etxtovpl}
% The macro:
% \begin{quote}
% |\etxtovpl|\marg{encoding list}\marg{vplfile}
% \end{quote}
% writes a virtual font (as a virtual property list) with the
% encoding specified by the items in the \meta{encoding list},
% which typically are names of ETX files.
% (This macro is called by |\installfont|.)
%
% \DescribeMacro{\etxtopl}
% The macro:
% \begin{quote}
% |\etxtopl|\marg{encoding list}\marg{plfile}
% \end{quote}
% writes a font (as a property list) with the encoding
% specified by the items in the \meta{encoding list},
% which typically are names of ETX files.
% (This macro is called by |\installrawfont|.)
%
% \multchanges{\cs{etxtovpl}\cs{etxtopl}}{1.923}{2002/10/24}{The
% first argument of these macros is now a comma-separated list
% of ETX files, and the items may be subjected to modifier
% clauses. (LH)}
%
% \begin{macro}{\etxtovpl}
% \changes{1.923}{2002/10/25}{The program is called \texttt{vptovf},
% not \texttt{vpltovf}. (LH)}
% \begin{macro}{\etxtopl}
% \begin{macrocode}
%<*pkg>
\def\etxtovpl#1#2{{
\def\vpl_extension{vpl}
\def\vpl_title{COMMENT}
\def\vpl_font{virtual~font}
\def\vpl_Font{Virtual~font}
\def\vpl_call{\string\etxtovpl{#1}{#2}}
\def\vpl_to_vf##1{vptovf~##1.vpl~##1.vf~##1.tfm}
\a_toks={}
\process_csep_list\make_inputetx #1,\process_csep_list,
\expandafter\etx_to_font \expandafter{\the\a_toks}{#2}
}}
\def\etxtopl#1#2{{
\def\vpl_extension{pl}
\def\vpl_title{COMMENT}
\def\vpl_font{font}
\def\vpl_Font{Font}
\def\vpl_call{\string\etxtopl{#1}{#2}}
\def\vpl_to_vf##1{pltotf~##1.pl~##1.tfm}
\_including_map_false
\global\rawfont_scaling=-\p@
\a_toks={}
\process_csep_list\make_inputetx #1,\process_csep_list,
\expandafter\etx_to_font \expandafter{\the\a_toks}{#2}
}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{switch}{_including_map_}
% \changes{1.900}{1998/10/02}{New switch that can inhibit writing of
% VPL-specific properties. (LH)}
% The v\,1.5 method of controlling whether \texttt{MAP} and
% \texttt{MAPFONT} properties should be written requires that some
% code is put in an awkward place (in |\make_mapfonts| rather than
% |\make_characters|). As the code was being reorganised anyway, it
% seemed best to let a switch control this instead. If
% |\if_including_map_| is true, \texttt{MAP} and \texttt{MAPFONT}
% properties are written to the file (which should be a VPL), if it is
% false then they are not written to the file (which is then a normal
% PL).
% \begin{macrocode}
\newif\if_including_map_
\_including_map_true
% \end{macrocode}
% \end{switch}
%
% \begin{macro}{\make_inputetx}
% The |\make_inputetx| macro takes a single argument that should have
% the form
% \begin{quote}
% \meta{file name root}\meta{optional modifiers}
% \end{quote}
% as explained in the comments to |\input_mtx_file|. The effect of
% this macro is to append some commands (usually
% |\inputetx|\marg{file name root}) to |\a_toks|. This may however
% change if some clause in the \meta{optional modifiers} redefines
% |\a_macro|.
% \changes{1.923}{2002/10/24}{Macro added. (LH)}
% \begin{macrocode}
\def\make_inputetx#1{
\def\a_macro{\noexpand\inputetx{\file_name}}
\get_file_name #1~{}~\par
\edef\a_macro{\a_macro}
\a_toks=\expandafter{ \the\expandafter\a_toks \a_macro}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IFKW-mtxasetx}
% The \texttt{mtxasetx} modifier clause causes the \meta{encoding
% list} item in question to be input using |\input_mtx_as_etx| rather
% than |\inputetx|. This makes it possible to use the |\setrawglyph|
% and |\setscaledrawglyph| commands in an MTX file as a poor
% substitute for a proper ETX file. This is sometimes useful for
% making proofs.
% \changes{1.923}{2002/10/24}{Macro added. (LH)}
% \begin{macrocode}
\x_cs\def{IFKW-mtxasetx}{
\def\a_macro{\noexpand\input_mtx_as_etx{\file_name}}
\get_keyword
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\etx_to_font}
% |\etx_to_font|\marg{encoding commands}\marg{fontfile} makes
% a (V)PL file whose encoding is specified by the \meta{encoding
% commands}. These are usually just one or a few |\inputetx|
% commands, as the specification of an encoding usually requires much
% more code than is convenient to provide as an argument.
% \changes{1.923}{2002/10/24}{Made the first argument a list of
% commands. Renamed \cs{vpl_caller} to \cs{vpl_call}; it is now
% assumed to contain the arguments as well. (LH)}
% \begin{macrocode}
\def\etx_to_font#1#2{
\make_assignments{#1}
\open_out{#2.\vpl_extension}
\top_of_pl_hook
\out_line{(\vpl_title\space\vpl_font\space
#2~created~by~fontinst~v\fontinstversion)}
\out_line{}
\out_line{(COMMENT~Filename:~#2.\vpl_extension)}
\out_line{(COMMENT~Created~by:~tex~\jobname)}
\out_line{(COMMENT~Created~using:~\vpl_call)}
\out_line{}
\out_line{(COMMENT~This~file~can~be~turned~into~a~\vpl_font\space
with)}
\out_line{(COMMENT~\vpl_to_vf{#2})}
\out_line{}
\out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)}
\out_line{}
\make_header{#1}
\if_including_map_ \make_mapfonts{#1} \fi
\make_fontdimens{#1}
\make_ligtable{#1}
\make_characters{#1}
\make_tidy{#1}
\out_line{}
\out_line{(COMMENT~END~OF~FILE~#2.\vpl_extension)}
\close_out{\vpl_Font}
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pre_first_etx_pass_hook}
% \begin{macro}{\pre_second_etx_pass_hook}
% \begin{macro}{\pre_third_etx_pass_hook}
% \begin{macro}{\pre_fourth_etx_pass_hook}
% \begin{macro}{\post_first_etx_pass_hook}
% \begin{macro}{\post_second_etx_pass_hook}
% \begin{macro}{\post_third_etx_pass_hook}
% \begin{macro}{\post_fourth_etx_pass_hook}
% \begin{macro}{\tidying_up_hook}
% \multchanges{\cs{pre_first_etx_pass_hook}^^A
% \cs{pre_second_etx_pass_hook}\cs{pre_third_etx_pass_hook}^^A
% \cs{pre_fourth_etx_pass_hook}\cs{post_first_etx_pass_hook}^^A
% \cs{post_second_etx_pass_hook}\cs{post_third_etx_pass_hook}^^A
% \cs{post_fourth_etx_pass_hook}\cs{tidying_up_hook}}{1.900}^^A
% {1998/09/30}{ETX-to-VPL hooks added. (LH)}
% \begin{macro}{\top_of_pl_hook}
% \changes{1.912}{2000/01/29}{Property list hook added. (LH)}
% As the |\etxtovpl| and |\etxtopl| macros are the
% lowest-level interfaces to what they do that are available in
% \package{fontinst} and as the amount of code they execute is really
% quite large, I suspect that users may occationally have need of
% some robust mechanism for inserting extra code at well specified
% positions. Such a mechanism is provided by the following hooks:
% \begin{macrocode}
\let\pre_first_etx_pass_hook\x_relax
\let\pre_second_etx_pass_hook\x_relax
\let\pre_third_etx_pass_hook\x_relax
\let\pre_fourth_etx_pass_hook\x_relax
\let\post_first_etx_pass_hook\x_relax
\let\post_second_etx_pass_hook\x_relax
\let\post_third_etx_pass_hook\x_relax
\let\post_fourth_etx_pass_hook\x_relax
\let\tidying_up_hook\x_relax
\let\top_of_pl_hook\x_relax
% \end{macrocode}
% The first nine are executed at the positions of the ETX-to-VPL
% file generation that their name indicate. |\top_of_pl_hook| is
% slightly different---it is executed right after a PL or VPL file
% is opened for writing. Thus it is also used by the MTX-to-PL system.
%
% To include code in one of them, one should write things like
% \begin{quote}
% |\add_to\pre_first_etx_pass_hook|\marg{extra code}
% \end{quote}
% I (LH) have the following in my \texttt{fontinst.rc} file\relax
% \SortIndex{fontinst.rc file}{\texttt{fontinst.rc} file}
% \begin{quote}
% |\add_to\top_of_pl_hook{\out_line{(COMMENT~-*-Text-*-)}}|
% \end{quote}
% Without it, my text editor annoys me by assuming that \texttt{.pl}
% stands for Perl.
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
%
%
% \subsection{Glyph to slot assignments}
%
% \changes{1.900}{1998/12/06}{New method of storing slot assignments.
% (LH)}
% The way \package{fontinst} has traditionally kept track
% of which glyph goes to which slot---information which is needed when
% writing the |LIGTABLE| in a (V)PL, for |\nextlarger|, and for the
% varchar commands---is by storing the slot number in the integer
% whose name is the name of the glyph. There are two main problems with
% this implementation: (i)~If a user sets an integer which happens to
% have the same name as a glyph that is not assigned to any slot, then
% kerns for that unused glyph might be written to the file, accidentally
% creating a kerning pair where there should be none. (ii)~It is only
% possible to store one slot number per glyph, so if one uses the same
% glyph for several slots then \package{fontinst} can only write kerns
% (and ligatures) for one of the occurences, despite the fact that all
% occurences have the same typographical need for them. These problems
% do only occur for glyphs on the right side of a ligature/kerning
% pair, but they are still serious enough. This part of
% \package{fontinst} has therefore been reimplemented.
%
% \changes{1.910}{1999/11/04}{Changed the way slot numbers are stored
% in \cs{slots-}\meta{glyph} control sequences. (LH)}
% The new implementation does not use integers, instead it uses a new
% family of macros with names on the form |\slots-|\meta{glyph}^^A
% \describecsfamily{slots-\meta{glyph}}. These macros expand to
% sequences of |\do|\thinspace\meta{character}, where \meta{character}
% is a category 12 (other) token whose character code equals the slot
% number.
%
% In the entire space of such names, each slot sould be mensioned
% at most once, with one exception, namely the slot which serves as
% right boundary marker, which may occur twice (once for the glyph
% which actually is assigned to the slot and once for the right boundary
% marker glyph). To detect whether there is a collision between these two
% uses of the slot, the right boundary marker glyph uses |\rboundary_do|
% instead of |\do| and the glyph whose slot serves as boundarychar uses
% |\rbserver_do| instead of |\do|. By redefining these two control
% sequences to generate a warning message when appropriate, the occurence
% of such a collision can be brought to the user's attention.
%
% \changes{1.900}{1998/12/11}{Added compability code for the old
% interface for boundary ligatures and kerns. (LH)}
% As it turned out to not be such a big deal, some extra code (protected
% by a \package{docstrip} switch called \Module{boundaryCompability})
% that makes \package{fontinst} compatible with the previous syntax for
% boundary handling has been included. I don't recommend using
% it though, since it makes \package{fontinst} store almost all slot
% numbers in two places.
%
%
% \begin{macro}{\make_assignments}
% \begin{macrocode}
\def\make_assignments#1{
\let\do_slot=\assign_slot
\let\end_do_slot=\end_assign_slot
\def\do_boundary{\bgroup
\let\makerightboundary=\bad_makerightboundary
}
\let\endsetleftboundary=\egroup
\let\makerightboundary=\assign_rboundary
\pre_first_etx_pass_hook
#1
\post_first_etx_pass_hook
\let\end_do_slot=\empty_command
\let\do_boundary=\x_relax
\let\endsetleftboundary=\x_relax
\let\makerightboundary=\gobble_one
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\assign_slot}
% \begin{macro}{\end_assign_slot}
% \changes{1.907}{1999/08/20}{Slots are not assigned to glyphs that
% do not exist. (LH)}
% |\assign_slot| begins the assignment of a slot to a glyph.
% |\end_assign_slot| completes it. In the time between these two,
% some information is stored in |\a_toks|, so that it can be
% modified by an intervening |\makerightboundary| (which is then
% |\assign_rboundary|).
%
% Note that the code below will not reset |\lccode0|. The value of
% this register should be considered uncertain while a ligful PL
% or VPL file is written, i.e., in ETX files.
% \SortIndex{lccode0}{\cs{lccode\,0} register\encapchar usage}
% \begin{macrocode}
\def\assign_slot{\a_toks={\do}}
\begingroup
\catcode0=12
\gdef\end_assign_slot{
\ifisglyph\slot_name\then
\lccode0=\slot_number
\lowercase{
\expandafter\add_to
\csname slots-\slot_name\expandafter\endcsname
\expandafter{\the\a_toks^^@}
}
%<boundaryCompability> \x_resetint\slot_name\slot_number
\fi
}
% \end{macrocode}
% \end{macro}\end{macro}
%
%
% \begin{macro}{\assign_rboundary}
% \begin{macro}{\bad_makerightboundary}
% |\assign_rboundary| is what |\makerightboundary| is when it is
% assigning a slot to act as right boundary marker.
%
% |\bad_makerightboundary| is what |\makerightboundary| temporarily
% gets set to between |\setleftboundary| and |\endsetleftboundary|.
% \begin{macrocode}
\gdef\assign_rboundary#1{
\lccode0=\slot_number
\lowercase{\x_cs\add_to{slots-#1}{\rboundary_do^^@}}
\x_setint{\percent_char boundarychar}\slot_number
\a_toks={\rbserver_do}
}
\endgroup
\def\bad_makerightboundary#1{
\errhelp={The~left~boundary~is~not~a~slot,~so~it~cannot~serve~
as~right~boundary.}
\errmessage{Incorrect~use~of~\string\makerightboundary}
}
% \end{macrocode}
% \end{macro} \end{macro}
%
% \begin{macro}{\get_slot_num}
% \changes{1.910}{1999/11/04}{Removed redefinition of \cs{do} to
% \cs{gobble_one} from temporary definition of \cs{do}, since a
% \cs{slots-} list usually contains only one or two elements
% anyway. (LH)}
% It is sometimes necessary to get the number of an arbitrary slot
% given only the name of the glyph which has been assigned to the
% slot. In such situations, the call
% \begin{quote}
% |\get_slot_num{|\meta{glyph}|}|
% \end{quote}
% will set |\result| to the number of one such slot if the glyph has
% been assigned to some slot, or set |\result| to minus one if the glyph
% has not been assigned to a slot.
% \begin{macrocode}
\def\get_slot_num#1{
%<*!boundaryCompability>
\global\result=-1
\bgroup
\def\do{\global\result=`}
\let\rbserver_do=\do
\let\rboundary_do=\gobble_one
\csname slots-#1\endcsname
\egroup
%</!boundaryCompability>
%<*boundaryCompability>
\ifisint{#1}\then
\global\result=\int{#1}
\else
\global\result=-1
\fi
\x_relax
%</boundaryCompability>
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ifisinslot}
% The call |\ifisinslot|\marg{glyph}\marg{slot}|\then| can be used to
% test whether glyph \meta{glyph} has been assigned to slot \meta{slot}.
% Both then-part and else-part of the conditional will however be
% ignored when the ETX file is read the first time, since the
% assignment of glyph to slots need not have been completed yet.
% \begin{macrocode}
\def\ifisinslot#1#2\then{
\ifx \makerightboundary\gobble_one
% \end{macrocode}
% This is used to test if the ETX file is being read in for the first
% time. It is a bit hacky, but it is efficient.
% \begin{macrocode}
\eval_expr{#2}
\begingroup
\def\do##1{\ifnum `##1=\result \let\do=\gobble_one \fi}
\def\rbserver_do{\do}
\let\rboundary_do=\gobble_one
\csname slots-#1\endcsname
\expandafter\endgroup
\ifx \do\gobble_one
\expandafter\expandafter \expandafter\if_true
\else
\expandafter\expandafter \expandafter\if_false
\fi
\else
\expandafter\gobble_if
\fi
}
%</pkg>
% \end{macrocode}
% \begin{macrocode}
%<*doc>
\def\ifisinslot#1#2\then{%
\generic@if{glyph \typeset@glyph{#1} assigned to slot
$\TypesetIntegerExpression{#2}$}%
}
%</doc>
% \end{macrocode}
% \end{macro}
%
%
% \subsection{The header, mapfonts, and fontdimens}
%
% \changes{1.913}{2000/02/26}{Using \cs{make_factor} for making PL
% reals, rather than \cs{afm_convert}+\cs{vpl_real}.
% \cs{scaled_design_size} replaced by new dimen \cs{mapfont_scaling} for
% determining mapfont atsize. (LH)}
%
% \begin{macro}{\mapfont_scaling}
% The |\mapfont_scaling| dimen is used for calculating how much a mapfont
% has been scaled, for use in \texttt{FONTAT} properties, and for
% selecting the correct mapfont. It is initialized to $1$.
% \begin{macrocode}
%<*pkg>
\newdimen\mapfont_scaling
\mapfont_scaling=1pt
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rawfont_scaling}
% The |\rawfont_scaling| dimen is used for communicating the scaling
% that has been applied to a raw font---a font being installed using
% |\install|\-|rawfont|\penalty0---out to that macro. |\rawfont_|\-^^A
% |scaling| should always be globally assigned.
% \changes{1.913}{2000/03/21}{Dimen added. (LH)}
% \begin{macrocode}
\newdimen\rawfont_scaling
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scaled_design_size}
% \begin{macro}{\afm_convert}
% The call
% \begin{quote}
% |\afm_convert|\meta{dimen}|=|\meta{integer expression}|;|
% \end{quote}
% converts a count into a dimen, assuming the count is a number
% of AFM units. I'll assume that the largest dimension I'll have
% to deal with is 131\,pt, to try to minimize rounding errors.
%
% \begin{macrocode}
% \newdimen\scaled_design_size
% \end{macrocode}
% \begin{macrocode}
% \def\afm_convert#1=#2;{
% \eval_expr{#2}
% #1=\scaled_design_size
% \divide#1 by 8
% \multiply #1 by \result
% \divide #1 by \one_thousand
% \multiply#1 by 8
% }
% \end{macrocode}
% \end{macro} \end{macro}
%
% \begin{macro}{\vpl_real}
% \begin{macro}{\vpl_int}
% The commands |\vpl_real|\meta{dimen} and |\vpl_int|\meta{count} print
% a dimension and integer respectively in (V)PL syntax.
%
% \begin{macrocode}
\def\vpl_real#1{R~\expandafter\lose_measure\the#1}
\def\vpl_int#1{D~\the#1}
% \end{macrocode}
% \end{macro} \end{macro}
%
%
% The count register |\boundary_char| has been removed, since
% the reimplementation of the left and right boundaries have drastically
% decreased the need to check which slot serves as the right boundary.
% Instead the integer |%boundarychar| (whose name cannot normally be typed)
% is used to store the number of this slot, but the user need never (and
% should not) access this integer directly. If the integer is not set
% then no slot serves as boundarychar.
% \changes{1.900}{1998/12/04}{\cs{boundary_char} count register
% removed. Right boundary slot number is now stored in the
% \texttt{\%boundarychar} integer instead. (LH)}
%
% \begin{macro}{\side_bearings}
% \begin{macro}{\curr_bearings}
% These two dimens are used by the letterspacing mechanism.
% \begin{macrocode}
\newdimen\side_bearings
\newdimen\curr_bearings
% \end{macrocode}
% \end{macro} \end{macro}
%
% \begin{macro}{\make_header}
% \begin{macrocode}
\def\make_header#1{
\global\font_count=0
\setdim{designsize}{10pt}
\a_dimen=\dim{designsize}
\out_line{(DESIGNSIZE~\vpl_real\a_dimen)}
\x_setstr{codingscheme}{UNKNOWN}
\out_line{(CODINGSCHEME~\str{codingscheme})}
%<*boundaryCompability>
\ifisint{boundarychar}\then
\x_setint{\percent_char boundarychar}{\int{boundarychar}}
\immediate\write16{Please~use~\string\setleftboundary\space
and/or~\string\makerightboundary^^J
instead~of~setting~the~boundarychar~integer.}
\fi
%</boundaryCompability>
\ifisint{\percent_char boundarychar}\then
\a_count=\int{\percent_char boundarychar}
\out_line{(BOUNDARYCHAR~\vpl_int\a_count)}
\fi
\x_setint{letterspacing}{0}
\side_bearings=\make_factor{\int{letterspacing}}\half_point
\x_setint{minimumkern}{0}
\minimum_kern=\int{minimumkern}
\out_line{}
}
% \end{macrocode}
% \changes{1.900}{1999/01/20}{Removed test for no letterspacing. (LH)}
% \changes{1.900}{1999/01/20}{Made integer expression \cs{div} a
% dimen \cs{divide}. (LH)}
% \end{macro}
%
%
% \begin{macro}{\make_mapfonts}
% \begin{macrocode}
\def\make_mapfonts#1{
\let\saved_scale\vpl_scale
\let\saved_mapfont\vpl_mapfont
\let\do_slot=\do_mapfont
\pre_second_etx_pass_hook
#1
\post_second_etx_pass_hook
\out_line{}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do_mapfont}
% |\do_mapfont| produces a |MAPFONT| entry for each font used by
% glyph |\slot_name|.
% \begin{macrocode}
\def\do_mapfont{
\ifisglyph\slot_name\then
\mapfonts\slot_name
\fi
}
% \end{macrocode}
% \end{macro}
%
% The following commands can be used in the \meta{mapfonts} glyph
% parameter.
%
% \begin{macro}{\vpl_scale}
% \begin{macrocode}
\def\vpl_scale#1#2{{
\mapfont_scaling=\make_factor{#1}\mapfont_scaling
#2
}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_mapfont}
% \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)}
% \changes{1.913}{2000/02/26}{Mapfont number control sequences are
% named \cs{\meta{scaling factor}pt-\meta{font}} instead of
% \cs{\meta{font}-\meta{scaling factor}pt}. They are also made
% \cs{mathchardef}s. (LH)}
% \begin{macrocode}
\def\vpl_mapfont#1#2{
\a_dimen=#2
\if_undefined{\the\mapfont_scaling-#1}\then
\global\x_cs\mathchardef{\the\mapfont_scaling-#1}=\font_count
\x_cs\xdef{f-\the\font_count}{\the\mapfont_scaling-#1}
\out_line{(MAPFONT~\vpl_int\font_count\space
(FONTNAME~#1)~
(FONTDSIZE~\vpl_real\a_dimen)~
(FONTAT~\vpl_real\mapfont_scaling))}
\record_usage{#1}
\global\advance\font_count by 1
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pl_mapfont}
% As PL files have no \texttt{MAPFONT} properties, the |\pl_mapfont|
% macro only needs to do one thing: copy the current value of
% |\mapfont_|\-|scaling| to |\rawfont_|\-|scaling|. This is necessary
% since if the raw font for which a ligful PL is being written has
% been scaled, then that scaling factor must be put in the appropriate
% place in the FD file entry, and the simplest way to determine this
% scaling factor is to execute the |\mapfonts| of some glyph in the
% font.
%
% Due to the fact that the second ETX file pass (that during which the
% \texttt{MAPFONT} properties are written) is skipped when a PL file
% is being written, the |\mapfonts| get executed during the fourth ETX
% file pass instead of the second. This works fine since the
% |\mapcommands| that are executed at that time when a VPL file is
% being written aren't needed for PL files.
% \changes{1.913}{2000/03/21}{Macro added. (LH)}
% \begin{macrocode}
\def\pl_mapfont#1#2{\global\rawfont_scaling=\mapfont_scaling}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\font_count}
% \begin{macro}{\next_mapfont}
% \begin{macro}{\prev_mapfont}
% \begin{macrocode}
\newcount\font_count
\newcount\next_mapfont
\newcount\prev_mapfont
% \end{macrocode}
% \end{macro} \end{macro} \end{macro}
%
%
% \begin{macro}{\make_fontdimens}
% This macro writes the \texttt{FONTDIMEN} property list. Note that
% there is a difference between fontdimen 1 and the others, in that
% fontdimen 1 is always in \texttt{pt}, not in the atsize-relative
% \texttt{FONTUNITS} unit that the others are. Nonetheless, they can
% both be treated the same here. This relies on (i) that 1000 denotes
% the factor 1, and (ii) that 1000 AFM units equals 1 fontunit.
% \begin{macrocode}
\def\make_fontdimens#1{
\out_line{(FONTDIMEN}
\a_count=1
\loop\ifnum 256>\a_count
\ifisint{fontdimen(\the\a_count)}\then
\out_lline{(PARAMETER~\vpl_int\a_count\space
R~\make_factor{\int{fontdimen(\the\a_count)}})}
\fi
\advance \a_count \@ne
\repeat
\out_lline{)}
\out_line{}
}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{The ligtable}
%
% \begin{macro}{\make_ligtable}
% \changes{1.927}{2003/12/08}{Changed the surrounding group to
% \cs{begingroup} type. This helps contain errors that arise when
% the \cs{setslot}s and \cs{endsetslot}s aren't properly balanced.
% (LH)}
% \begin{macrocode}
\def\make_ligtable#1{
\begingroup
\out_line{(LIGTABLE}
%<!boundaryCompability> \let\do_slot=\bgroup
%<*boundaryCompability>
\def\do_slot{\bgroup
\ifisint{boundarychar}\then
\ifnum \int{boundarychar}=\slot_number
\def\vpl_liglabel{\out_liglabel\boundary_liglabel}
\fi
\fi
}
%</boundaryCompability>
\let\end_do_slot=\vpl_kerning
\def\do_boundary{\bgroup \let\vpl_liglabel=\boundary_liglabel}
\let\endsetleftboundary=\vpl_kerning
\let\ligature=\vpl_ligature
\let\k=\vpl_kern
\let\rbserver_do=\vpl_rbserver_do
\let\rboundary_do=\vpl_rboundary_do
\pre_third_etx_pass_hook
#1
\post_third_etx_pass_hook
\out_lline{)}
\endgroup
\out_line{}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_rbserver_do}
% \begin{macro}{\vpl_rboundary_do}
% \begin{macro}{\wrn_rboundary_do}
% |\vpl_rbserver_do| and |\vpl_rboundary_do| are what |\rbserver_do|
% and |\rboundary_do| respectively are when a ligkern program is being
% written and no entry has yet been written for the boundarychar
% slot. |\wrn_rboundary_do| is what one of them will get set to
% afterwards, so that warnings are written when collisions between
% using the slot as a right boundary marker and using the slot for
% the actual glyph occur.
% \begin{macrocode}
\def\vpl_rbserver_do#1{
\do{#1}
\let\rboundary_do=\wrn_rboundary_do
}
\def\vpl_rboundary_do#1{
\do{#1}
\let\rbserver_do=\wrn_rboundary_do
}
\def\wrn_rboundary_do#1{
\do{#1}
\immediate\write16{Boundarychar~slot~usage~collision~in~
`\slot_name'~ligkern~program.}
}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
%
% \begin{macro}{\vpl_ligature}
% |\vpl_ligature{|\meta{type}|}{|\meta{glyph}|}{|\meta{glyph}|}|
% produces a ligtable entry for glyph |\slot_name|.
%
% The double spaces in the |\out_lline| statement below might look
% strange, but |\number| will always gobble the first one.
% \begin{macrocode}
\def\vpl_ligature#1#2#3{
\get_slot_num{#3}
\ifnum -1=\result
\immediate\write16{Warning:~\string\ligature\space
for~unknown~slot~`#3'.}
\else
\x_cs\ifx{slots-#2}\x_relax
\immediate\write16{Warning:~\string\ligature\space
for~unknown~slot~`#2'.}
\else
\def\do##1{
\vpl_liglabel
\out_lline{(#1~D~\number`##1~\space\vpl_int\result)~
(COMMENT~#2~#3)}
}
\csname slots-#2\endcsname
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\vpl_kerning}
% |\vpl_kerning| writes out kerning instructions.
% \begin{macrocode}
\def\vpl_kerning{
\let\do=\vpl_kern_do
\csname~r-\slot_name\endcsname
\vpl_ligstop
\egroup
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_kern}
% |\vpl_kern|\,|\l-|\meta{name}\,|\|\meta{amount} writes out a |KRN|
% instruction.
%
% \changes{1.900}{1998/10/02}{Macro modified to avoid duplicate kerns.
% (LH)}
% |\vpl_kern| has been modified so that at most one
% \texttt{KRN} instruction is written for each (ordered) pair of
% characters. The idea is basically to make \package{fontinst} forget,
% until the end of |\vpl_kerning|, that the glyph for which |\vpl_kern|
% is being called has been assigned a slot, as this stops any more
% \texttt{KRN} instructions for that particular glyph from being
% written. |\vpl_kern| has also been modified so that it will not write
% out any \texttt{KRN} instructions for kerns whose absolute value is
% less than or equal to |\minimum_kern|. |\minimum_kern| gets set to
% the value of the integer \texttt{minimumkern} in |\make_header|. If
% the user has not set \texttt{minimumkern}, a default value of 0 will
% be supplied by \package{fontinst}.
%
% \changes{1.900}{1998/12/07}{Much of the code from \cs{vpl_kern} has
% been moved to \cs{vpl_kern_do}. (LH)}
% \changes{1.913}{2000/02/26}{Using a nested \cs{ifnum} construct to
% test the condition $\left\protect\vert
% \protect\mbox{\cs{a_count}}\right\protect\vert \quotechar >
% \protect\mbox{\cs{minimum_kern}}$. (LH)}
% \begin{macrocode}
\def\vpl_kern#1#2{
\edef\a_macro{\expandafter\gobble_three\string#1}
\a_count=\expandafter\gobble_one\string#2\x_relax
\ifnum \ifnum -\a_count>\a_count - \fi\a_count>\minimum_kern
\edef\b_macro{~R~\make_factor\a_count}
\csname slots-\a_macro\endcsname
\fi
\x_cs\let{slots-\a_macro}=\x_relax
}
% \end{macrocode}
% Observation (LH 1999/03/16): The above construction has the
% side-effect that a direct contradiction between a right boundary
% glyph and a glyph in the |%boundarychar| slot won't be detected if
% one of the items in contradiction is a kern less than or equal to
% |\minimum_kern|. Perhaps this should be changed (letting |\do| equal
% to |\gobble_one| would let the dectection mechanism work, but |\do|
% would have to be restored afterwards and it is doubtful if it is
% worth it).
% \end{macro}
%
%
% \begin{macro}{\vpl_kern_do}
% |\vpl_kern_do| is what |\do| is defined to be when kerns are written.
% \begin{macrocode}
\def\vpl_kern_do#1{
\vpl_liglabel
\out_lline{
(KRN~D~\number`#1~\b_macro)~
(COMMENT~\a_macro)
}
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\out_liglabel}
% \begin{macro}{\boundary_liglabel}
% \begin{macro}{\vpl_liglabel}
% |\out_liglabel| writes out a |LIGLABEL| instruction for a slot.
% |\boundary_liglabel| writes out a |LIGLABEL| instruction for the
% |BOUNDARYCHAR| ligkern program. |\vpl_liglabel| writes out the
% correct |LIGLABEL| instruction for the current ligkern program, if it
% is approriate.
%
% \begin{macrocode}
\def\out_liglabel{
\out_lline{(LABEL~\vpl_int\slot_number)~(COMMENT~\slot_name)}
\let\vpl_liglabel=\x_relax
\let\vpl_ligstop=\out_ligstop
}
\def\boundary_liglabel{
\out_lline{(LABEL~BOUNDARYCHAR)~(COMMENT~\slot_name)}
\let\vpl_liglabel=\x_relax
\let\vpl_ligstop=\out_ligstop
}
\let\vpl_liglabel=\out_liglabel
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\out_ligstop}
% \begin{macro}{\vpl_ligstop}
% |\vpl_ligstop| writes out a |LIGSTOP| instruction if appropriate.
% \begin{macrocode}
\def\out_ligstop{\out_lline{(STOP)}
\let\vpl_liglabel=\out_liglabel
\let\vpl_ligstop=\x_relax}
\let\vpl_ligstop=\x_relax
% \end{macrocode}
% \end{macro} \end{macro}
%
%
% \subsection{The characters}
%
% \begin{macro}{\make_characters}
% \begin{macrocode}
\def\make_characters#1{
\bgroup
\let\do_slot=\do_character
\let\end_do_slot=\end_do_character
\let\nextlarger=\vpl_nextlarger
\let\varchar=\vpl_varchar
\let\endvarchar=\end_vpl_varchar
\let\vartop=\vpl_vartop
\let\varmid=\vpl_varmid
\let\varbot=\vpl_varbot
\let\varrep=\vpl_varrep
\if_including_map_
\let\saved_raw\vpl_raw
\let\saved_rule\vpl_rule
\let\saved_special\vpl_special
\let\saved_warning\vpl_warning
\let\saved_movert\vpl_movert
\let\saved_moveup\vpl_moveup
\let\saved_push\vpl_push
\let\saved_pop\vpl_pop
\else
\def\do_character_map{
\ifdim \rawfont_scaling=-\p@
\mapfonts\slot_name
\else
\let\do_character_map=\x_relax
\fi
}
\let\saved_mapfont\pl_mapfont
\let\saved_scale\vpl_scale
\fi
\pre_fourth_etx_pass_hook
#1
\post_fourth_etx_pass_hook
\egroup
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do_character}
% \changes{1.913}{2000/03/10}{Negative italic corrections \emph{are}
% written to the (V)PL being generated. (LH)}
% \changes{1.927}{2004/07/13}{Added flag for emitting warning message
% when a glyph is missing. (LH) Requested by Werner Lemberg.}
% |\do_character| produces a character entry for glyph |\slot_name| in
% slot |\slot_number|.
%
% \begin{macrocode}
\def\do_character{
\if_undefined{g-\slot_name}\then
\ifisint{requireglyphs}\then
\fontinstwarning{ETX~to~(V)PL}{
Undefined~glyph~`\slot_name'~requested\message_break
for~slot~\the\slot_number\message_number}
\fi
\expandafter\gobble_setslot
\else
\ifx\slot_name\notdef_name\else
\out_line{(CHARACTER~\vpl_int\slot_number\space
(COMMENT~\slot_name)}
\glyph_parameter\glyph_metrics\slot_name
\a_dimen=\make_factor\a_count \p@
\do_character_sidebearings
\out_lline{(CHARWD~\vpl_real\a_dimen)}
\ifnum \z@=\b_count \else
\out_lline{(CHARHT~R~\make_factor\b_count)}
\fi
\ifnum \z@=\c_count \else
\out_lline{(CHARDP~R~\make_factor\c_count)}
\fi
\ifnum \z@=\d_count \else
\out_lline{(CHARIC~R~\make_factor\d_count)}
\fi
\do_character_map
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do_character_sidebearings}
% \begin{macrocode}
\def\do_character_sidebearings{
\ifisint{\slot_name-spacing}\then
\curr_bearings=\make_factor{\int{\slot_name-spacing}}\half_point
\else
\curr_bearings=\side_bearings
\fi
\advance\a_dimen by 2\curr_bearings
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do_character_map}
% \begin{macrocode}
\def\do_character_map{
\global\prev_mapfont=0
\out_lline{(MAP}
\ifdim 0pt=\curr_bearings
\mapcommands\slot_name
\else
\out_llline{(MOVERIGHT~\vpl_real\curr_bearings)}
\mapcommands\slot_name
\out_llline{(MOVERIGHT~\vpl_real\curr_bearings)}
\fi
\out_llline{)}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do_character_no_letterspacing}
% LH 1999/03/27: This is an alternative version of |\do_character|
% which I think is now antiquated. It used to have an advantage over
% |\do_character| in that it did not do any letterspacing (in v\,1.5,
% that was good since |\do_character| used to write code for
% letterspacing to the VPL regardless of whether is was needed or
% not), but that advantage is gone since |\do_character_map| is now
% a bit less stupid than it used to be.
%
% For the record, I don't think there ever was a user interface for
% using this macro instead of |\do_character|, but I suspect there
% are plenty of people around who have hacked it into being used.
%
% With v\,1.913 I commented it out completely, since I didn't feel
% like updating the calls to |\afm_convert|.
% \begin{macrocode}
%<*obsolete>
% \def\do_character_no_letterspacing{
% \x_cs\ifx{g-\slot_name}\x_relax
% \expandafter\gobble_setslot
% \else
% \ifx\slot_name\notdef_name\else
% \out_line{(CHARACTER~\vpl_int\slot_number\space
% (COMMENT~\slot_name)}
% \afm_convert\a_dimen=\width\slot_name;
% \out_lline{(CHARWD~\vpl_real\a_dimen)}
% \afm_convert\a_dimen=\height\slot_name;
% \out_lline{(CHARHT~\vpl_real\a_dimen)}
% \afm_convert\a_dimen=\depth\slot_name;
% \out_lline{(CHARDP~\vpl_real\a_dimen)}
% \afm_convert\a_dimen=\italic\slot_name;
% \ifnum\a_dimen>0 \out_lline{(CHARIC~\vpl_real\a_dimen)} \fi
% \global\prev_mapfont=0 \out_lline{(MAP}
% \mapcommands\slot_name
% \out_llline{)}
% \fi
% \fi
% }
%</obsolete>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\gobble_setslot}
% \begin{macrocode}
\long\def\gobble_setslot#1\endsetslot{\endsetslot}
% \end{macrocode}
% \changes{1.901}{1999/03/27}{Made \cs{gobble_setslot} a \cs{long}
% macro. (LH)}
% \end{macro}
%
% \begin{macro}{\end_do_character}
% \begin{macrocode}
\def\end_do_character{
\ifisglyph\slot_name\then
\out_lline{)}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\notdef_name}
% \begin{macrocode}
\def\notdef_name{.notdef}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Slot commands that put things in a character property list}
%
% Here follows the active definitions for those slot commands that
% causes things to be put in |CHARACTER| property lists.
%
% \begin{macro}{\vpl_nextlarger}
% |\vpl_nextlarger|\marg{name} produces a |NEXTLARGER| entry.
% \begin{macrocode}
\def\vpl_nextlarger#1{
\get_slot_num{#1}
\ifnum -1<\result
\out_lline{(NEXTLARGER~D~\the\result)~(COMMENT~#1)}
\else
\immediate\write16{Warning:~\string\nextlarger\space
for~unknown~slot~`#1'}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_varchar}
% \begin{macro}{\end_vpl_varchar}
% |\vpl_varchar| \meta{varchar commands} |\end_vpl_varchar| produces
% a |VARCHAR| entry.
%
% \begin{macrocode}
\def\vpl_varchar{\out_lline{(VARCHAR}}
% \end{macrocode}
% \begin{macrocode}
\def\end_vpl_varchar{\out_llline{)}}
% \end{macrocode}
% \end{macro} \end{macro}
%
%
% \begin{macro}{\vpl_vartop}
% \begin{macrocode}
\def\vpl_vartop#1{
\get_slot_num{#1}
\ifnum -1<\result
\out_llline{(TOP~D~\the\result)~(COMMENT~#1)}
\else
\immediate\write16{Warning:~\string\vartop\space
for~unknown~slot~`#1'}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_varmid}
% \begin{macrocode}
\def\vpl_varmid#1{
\get_slot_num{#1}
\ifnum -1<\result
\out_llline{(MID~D~\the\result)~(COMMENT~#1)}
\else
\immediate\write16{Warning:~\string\varmid\space
for~unknown~slot~`#1'}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_varbot}
% \begin{macrocode}
\def\vpl_varbot#1{
\get_slot_num{#1}
\ifnum -1<\result
\out_llline{(BOT~D~\the\result)~(COMMENT~#1)}
\else
\immediate\write16{Warning:~\string\varbot\space
for~unknown~slot~`#1'}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_varrep}
% \begin{macrocode}
\def\vpl_varrep#1{
\get_slot_num{#1}
\ifnum -1<\result
\out_llline{(REP~D~\the\result)~(COMMENT~#1)}
\else
\immediate\write16{Warning:~\string\varrep\space
for~unknown~slot~`#1'}
\fi
}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Saved map commands}
%
% The following commands (and |\vpl_scale|, which is defined above) can
% be used in the \meta{mapcommands} glyph parameter.
%
% \begin{macro}{\vpl_raw}
% This macro writes the entries in a \texttt{MAP} that are needed for
% the given raw character. Note that the `at' comment below gives the
% scaling relative to the atsize of the virtual font, not the physical
% atsize.
% \IndexEntry{\LevelSame{PL properties:}^^A
% \LevelSorted{SELECTFONT}{\texttt{SELECTFONT}}^^A
% }{usage}{\thepage}
% \begin{macrocode}
\def\vpl_raw#1#2#3{
\global\next_mapfont=\csname\the\mapfont_scaling-#1\endcsname
\ifnum \next_mapfont=\prev_mapfont \else
\out_llline{(SELECTFONT~\vpl_int\next_mapfont)~
(COMMENT~#1~at~
\expandafter\lose_measure \the\mapfont_scaling)}
\fi
\out_llline{(SETCHAR~D~#2)~(COMMENT~#3)}
\global\prev_mapfont=\next_mapfont
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_rule}
% \begin{macrocode}
\def\vpl_rule#1#2{
\a_dimen=\make_factor{#2}\mapfont_scaling
\b_dimen=\make_factor{#1}\mapfont_scaling
\out_llline{(SETRULE~\vpl_real\a_dimen\space\vpl_real\b_dimen)}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vpl_special}
% \begin{macro}{\vpl_warning}
% \begin{switch}{warningspecials}
% \changes{1.913}{2000/02/26}{Switch controlling whether
% \cs{glyphwarning}s should put \texttt{SPECIALS} in the VPL was
% added. (LH)}
% \begin{macrocode}
\def\vpl_special#1{
\out_llline{(SPECIAL~#1)}}
% \end{macrocode}
% \begin{macrocode}
\def\vpl_warning#1{
\ifwarningspecials
\out_llline{(SPECIAL~Warning:~#1)}
\fi
\immediate\write16{Warning:~#1.}
}
% \end{macrocode}
% \begin{macrocode}
\newif\ifwarningspecials
\warningspecialstrue
% \end{macrocode}
% \end{switch}\end{macro}\end{macro}
%
% \begin{macro}{\vpl_movert}
% \begin{macro}{\vpl_moveup}
% \begin{macrocode}
\def\vpl_movert#1{
\a_dimen=\make_factor{#1}\mapfont_scaling
\out_llline{(MOVERIGHT~\vpl_real\a_dimen)}
}
% \end{macrocode}
% \begin{macrocode}
\def\vpl_moveup#1{
\a_dimen=\make_factor{#1}\mapfont_scaling
\out_llline{(MOVEUP~\vpl_real\a_dimen)}
}
% \end{macrocode}
% \end{macro} \end{macro}
%
% \begin{macro}{\vpl_push}
% \begin{macro}{\vpl_pop}
% \begin{macrocode}
\def\vpl_push{\out_llline{(PUSH)}}
% \end{macrocode}
% \begin{macrocode}
\def\vpl_pop{\out_llline{(POP)}}
% \end{macrocode}
% \end{macro} \end{macro}
%
%
% \subsection{Tidying up}
%
% \begin{macro}{\make_tidy}
% If a VPL file was written, the tidying up consists of clearing the
% list of mapfont numbers, since that is stored globally. If a PL
% file was written, the tidying up consists of writing a
% \texttt{DESIGNUNITS} property for those fonts which need one.
% \begin{macrocode}
\def\make_tidy#1{
\tidying_up_hook
\if_including_map_
\a_count=0
\loop\ifnum \a_count<\font_count
\edef\a_macro{\csname~f-\the\a_count\endcsname}
\global\x_cs\let\a_macro\x_relax
\advance\a_count by 1
\repeat
\global\font_count=0
\else
\ifdim \rawfont_scaling<\z@
\fontinstwarning{ETX~to~(V)PL}{The~font~
\out_filename\space doesn't~contain~any~characters}
\global\rawfont_scaling=\p@
\fi
\ifdim \rawfont_scaling=\p@ \else
\out_line{(DESIGNUNITS~\vpl_real\rawfont_scaling)}
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{Font installation commands and \texttt{.fd} files}
%
% \DescribeMacro{\installfonts}
% \DescribeMacro{\endinstallfonts}
% The call
% \begin{quote}
% |\installfonts| \meta{install commands} |\endinstallfonts|
% \end{quote}
% is the top-level interface for installing a number of fonts
% and creating |.fd| files for them.
%
% \DescribeMacro{\installfamily}
% \DescribeMacro{\installfont}
% \DescribeMacro{\installrawfont}
% The \meta{install commands} are:
% \begin{isyntax}
% |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands}\\
% |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\penalty0
% \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
% |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}^^A
% \penalty0
% \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
% |\installfontas|\marg{font-name}\penalty0\marg{encoding}^^A
% \marg{family}\marg{series}\marg{shape}\marg{size}
% \end{isyntax}
%
% Each |\installfamily| command causes the generation of an |.fd| file
% for \meta{encoding} and \meta{family}, which is writen out by the time
% |\endinstallfonts| is processed.
%
% Each |\installfont| generates a |.vpl| font by calling |\etxtovpl|
% and adds an |.fd| entry.
% Each |\installrawfont| generates a ligfull |.pl| font by calling
% |\etxtopl| and adds an |.fd| entry. (Raw |.pl| fonts, containing only
% the glyph metrics without any ligaturing or kerning information,
% are also generated by |\mtxtopl| called from |\transformfont|
% statements.)
%
% \changes{1.912}{2000/01/15}{\cs{install}\dots\ commands updated to
% set \cs{setsomething_global} to \cs{global} around themselves. This
% reduces problems with assignments ``not working'' due to the
% unintuitive grouping. (LH) Problem pointed out by Hilmar
% Schlegel, , and others.}
%
% \begin{macro}{\installfonts}
% Initializes the |\family_toks| token register, which is used to store
% the information which is written out to |.fd| files at the end of the
% job.
%
% \begin{macrocode}
\newtoks\family_toks
\def\installfonts{
\bgroup
\global\family_toks={}
\gdef\prev_file_list{}
\global\let\setsomething_global=\global
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\installfamily}
% |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands}
%
% Adds the command
% \begin{quote}
% |\fd_family|\marg{encoding}\marg{family}\marg{FD-commmands}
% \end{quote}
% to the token list |\family_toks| and defines a macro
% |\|\meta{encoding}|-|\meta{family}.^^A
% \describecsfamily{\meta{encoding}-\meta{family}}
%
% \begin{macrocode}
\def\installfamily#1#2#3{
\global\family_toks=
\expandafter{\the\family_toks\fd_family{#1}{#2}{#3}}
\global\x_cs\let{#1-#2}\empty_command
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\installfont}
% \begin{macro}{\installrawfont}
% \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)}
% \multchanges{\cs{installfont}\cs{installrawfont}}{1.913}{2000/03/21}
% {Moved some code from \cs{install_font} to these commands. (LH)}
% |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\\
% \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A
% \marg{shape}\marg{size}\\
% |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}\\
% \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A
% \marg{shape}\marg{size}
%
% \begin{macrocode}
\def\installfont#1#2#3#4#5#6#7#8{
\global\let\setsomething_global=\x_relax
\input_metrics{}{#2}
\etxtovpl{#3}{#1}
\installfontas{#1}{#4}{#5}{#6}{#7}{#8}
\global\let\setsomething_global=\global
}
\def\installrawfont#1#2#3#4#5#6#7#8{
\global\let\setsomething_global=\x_relax
\xdef\out_filename{#1}
\input_metrics{\let\storemapdata=\installraw_storemap}{#2}
\let\storemapdata=\gobble_three
\etxtopl{#3}{#1}
\record_usage{#1}
\installfontas{
\ifdim \rawfont_scaling=\p@ \else
[\expandafter\lose_measure\the\rawfont_scaling]~
\fi #1
}{#4}{#5}{#6}{#7}{#8}
\global\let\setsomething_global=\global
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\installraw_storemap}
% The |\installraw_storemap| macro is a definition of |\storemapdata|
% that is used when the metrics for a ligful PL file is being inputed.
% Its job is to write a |\storemapdata| command for this PL to the
% transforms record file if the PL being written does not have the
% same name as the MTX that the metrics are taken from (the
% information is already stored if both files have the same name).
% |\out_filename| is prematurely set by |\installrawfont| (i.e., long
% before the PL file is actually opened) so that it can be used in
% comparing the file names.
% \changes{1.913}{1999/03/23}{Macro added. (LH)}
% \begin{macrocode}
\def\installraw_storemap#1#2#3{
\def\a_macro{#1}
\ifx \a_macro\out_filename \else
\record_transform{\out_filename}{\string\frommtx{#1}}{}\if_false
\fi
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\input_metrics}
% The |\input_metrics| macro takes a comma-separated list of metric
% files as its second argument and sees to that exactly these metrics
% are loaded. If the list is identical to that used in the last call
% to |\input_metrics|, then this is already the case and
% |\input_metrics| simply refrains from flushing those previous
% metrics from \TeX's memory. Otherwise it closes a group (flushing
% the metrics from a previous call), opens a group (so that these
% metrics can be flushed at the next |\installfont| or
% |\installrawfont| command, if necessary), and starts inputting the
% metrics files in question.
%
% The first argument consists of code that will be executed after the
% group has been closed and opened, but before any metrics is inputed.
% \changes{1.900}{1999/02/13}
% {Use \cs{process_csep_list} for file-list. (LH)}
% \changes{1.914}{2000/05/26}{Redefined to suite \cs{file_list_metrics}.
% In particular, there will now be a comma at the end of
% \cs{curr_file_list} and \cs{prev_file_list}. (LH)}
% \begin{macrocode}
\def\input_metrics#1#2{
\let\metrics=\file_list_metrics
\xdef\curr_file_list{#2,}
\let\metrics=\x_relax
\ifx\prev_file_list\curr_file_list\else
\egroup\bgroup
#1
\expandafter\process_csep_list \expandafter\input_mtx_file
\curr_file_list\process_csep_list,
\global\let\prev_file_list=\curr_file_list
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\file_list_metrics}
% The |\file_list_metrics| macro is a definition of |\metrics| that
% is used in the \meta{file-list} argument of |\install|\-|font| and
% |\install|\-|raw|\-|font| when that is |\xdef|ed by |\input_metrics|.
% This special definition prevents the succeeding \meta{metric
% commands} from getting expanded.
% \changes{1.914}{2000/05/26}{Macro added. (LH)}
% \begin{macrocode}
\def\file_list_metrics#1,{
\iffalse{\fi}
\a_toks=\expandafter{\curr_file_list\x_relax#1,}
\xdef\curr_file_list{\the\a_toks \iffalse}\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\installfontas}
% The |\installfontas| command has the syntax
% \begin{isyntax}
% |\installfontas|\marg{font-info}\marg{encoding}\marg{family}^^A
% \penalty0\marg{series}\penalty0\marg{shape}\penalty0\marg{size}
% \end{isyntax}
% The precise definition of a \meta{font-info} can be found in
% \cite[Sec.~4]{fntguide}, here it suffices to say that a font name
% (name of (V)PL file) is a valid \meta{font-info}. The |\installfontas|
% command adds an entry for the \meta{font-info} font to a font
% definition file, giving it the NFSS attributes \meta{encoding}^^A
% \texttt{/}\nolinebreak[1]\meta{family}\texttt{/}\nolinebreak[1]^^A
% \meta{series}\texttt{/}\nolinebreak[1]\meta{shape}\texttt{/}^^A
% \nolinebreak[1]\meta{size}. The substitution mechanism will act on
% \meta{series} and \meta{shape}, and it is therefore possible that
% \meta{font-info} will appear in more than one |\Declare|\-|Font|\-^^A
% |Shape| command. \meta{size} can be either some \meta{size-infos},
% as defined in \cite[Sec.~4]{fntguide}, or a \package{fontinst}
% shorthand for a such, declared using |\declaresize|.
% \changes{1.912}{2000/01/16}{Command added. (LH)}
% \changes{1.913}{2000/03/02}{Specification changed to allow
% arbitrary \meta{font-info}s as first argument. (LH)}
% \changes{1.921}{2002/03/27}{Automatically doing an
% \cs{installfamily} if that has not been done. (LH) Suggested
% by Rowland McDonnell.}
% \begin{macrocode}
\def\installfontas#1#2#3#4#5#6{
\if_undefined{#2-#3-#4-#5}\then
\let\do_shape=\x_relax
\if_undefined{#2-#3}\then
\x_cs\let{#2-#3}\empty_command
\autoinstallfamily{#2}{#3}
\fi
\x_cs\xdef{#2-#3}{
\csname#2-#3\endcsname
\do_shape{#2}{#3}{#4}{#5}
}
\fi
\let\do_size=\x_relax
\x_cs\xdef{#2-#3-#4-#5}{
\if_defined{#2-#3-#4-#5}\then
\csname#2-#3-#4-#5\endcsname
\fi
\do_size{#6}{#1}
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\autoinstallfamily}
% This command is called by |\installfontas| when it is asked to
% install a font for which no |\installfamily| has been given. The
% syntax is
% \begin{quote}
% |\autoinstallfamily|\marg{encoding}\marg{family}
% \end{quote}
% It defaults to calling |\installfamily| in the obvious way, but
% it can be redefined if the user wants something different.
% \changes{1.924}{2003/02/08}{Macro added. (LH)}
% \begin{macrocode}
\def\autoinstallfamily#1#2{\installfamily{#1}{#2}{}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endinstallfonts}
% Finish the installation by processing the |\family_toks|
% token register, which contains the accumulated information
% to be written out to |.fd| files.
%
% \begin{macrocode}
\def\endinstallfonts{
\global\let\setsomething_global=\x_relax
\let\do_shape=\fd_shape
\let\do_size=\fd_size
\the\family_toks
\global\family_toks{}
\egroup
}
% \end{macrocode}
% \end{macro}
%
%
% The |\installfont| command has traditionally allowed that names of
% base fonts (MTX files) are suffixed by a
% \verb*" scaled "\meta{factor} that would cause the \texttt{rawscale}
% integer to be set and thereby scale everything that was in that base
% font by the said \meta{factor}. There is now a more general approach
% to this. If the control sequence
% \describecsfamily{IFKW-\meta{keyword}}|IFKW-|\meta{keyword} is
% defined then \meta{keyword} may be used as \texttt{scaled} is above;
% this control sequence should grab all the ``arguments'' of the
% keyword, process them as necessary, and end with the |\get_keyword|
% macro so that another keyword may be processed. As a rule, the
% arguments and keywords are delimited from each other by single spaces.
% A macro grabbing an argument grabs also the space after it. The
% \texttt{IFKW} is for \texttt{I}nstall\texttt{F}ont
% \texttt{K}ey\texttt{W}ord.
%
% \changes{1.923}{2002/10/09}{Added support for keywords other than
% \texttt{scaled} in the second argument of \cs{installfont} and
% such. (LH)}
%
% \begin{macro}{\input_mtx_file}
% The |\input_mtx_macro| takes one undelimited argument. It
% interprets this argument as if it was one item in the \meta{file-list}
% argument of |\install|\-|font| or |\install|\-|rawfont|, and does
% the corresponding processing. The argument should be one of the
% following three things:
% \begin{quote}
% \meta{font}\meta{optional modifiers}\\
% |\metrics| \meta{metric commands}\\
% \meta{nothing}
% \end{quote}
% If, in the first case, an MTX file for \meta{font} does not
% exist then it is generated on the fly from a corresponding |.pl|,
% |.afm|, or |.vpl| file in the call to |\fromany|. In the second
% case, the \meta{metric commands} simply get executed. In the third
% case, nothing happens.
%
% The \meta{optional modifiers} is either empty or has the form
% \meta{modifier clause}\meta{optional modifiers}. A \meta{modifier
% clause} generally has the form
% \begin{quote}
% \verb*" "\meta{keyword}\verb*" "\meta{argument(s)}
% \end{quote}
% e.g.,
% \begin{quote}
% \verb*| scaled |\meta{rawscale factor}
% \end{quote}
%
% \changes{1.904}{1999/06/16}{Now using \cs{fromany} to make an MTX
% file when necessary. Furthermore testing for empty argument using
% \cs{ifx} rather than \cs{if}. (LH)}
% \changes{1.912}{2000/01/15}{Added error message. (LH) Suggested by
% Alexei Kostin.}
% \changes{1.914}{2000/05/26}{Can now accept arbitrary metric
% commands in argument. (LH)}
% \begin{macrocode}
\def\input_mtx_file#1{
\reset_modifiers_hook
\ifx\x_relax#1\x_relax
% \end{macrocode}
% This tests for an empty argument, but it also lets explicit metric
% commands be executed.
% \begin{macrocode}
\else
\identity_one{\get_file_name #1~}~\par
% \end{macrocode}
% The two spaces have the effect of putting an empty keyword modifier
% last in the \meta{optional modifiers}. If everything is all right
% then this will gobble the |\par|. However, if the user forgot some
% argument of the last keyword then there will be an error message
% when |\get_keyword| will try to grab the next keyword.
%
% If an encoding has been specified then the source file must be a PL
% or VPL file (since these are the only ones for which it makes sense
% to specify an encoding), otherwise we rely on |\fromany| to find a
% font metrics file.
% \changes{1.926}{2003/07/10}{Only looking for PL and VPL files when
% an encoding is specified. (LH)}
% \changes{1.929}{2005/01/13}{Missing space in message inserted. (LH)
% Pointed out by Peter Dyballa.}
% \begin{macrocode}
\ifx \pl_encoding\empty_command
\fromany\file_name
\else
\metrics_given_encoding{\file_name}{\pl_encoding}
\fi
\ifisstr{afm-name}\then
\inputmtx{\str{afm-name}}
\else
\fontinsterror{\string\install...}{
Font/MTX~file~\file_name\space not~found
}{
You~can~insert~an~\string\inputmtx\space command~here
\messagebreak to~input~some~other~MTX~file~instead.
\ifisint{rawscale}\then \messagebreak
The~requested~raw~scaling~will~then~be~applied~on~that.
\fi
}
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\metrics_given_encoding}
% This macro is a cousin of |\fromany|, for the case that metrics are
% taken from a (V)PL file that furthermore is assigned nonstandard
% metrics. The syntax is
% \begin{quote}
% |\metrics_given_encoding|\marg{font}\marg{etx}
% \end{quote}
% and the generated MTX file is named
% \meta{font}\texttt{-}\meta{etx}\texttt{.mtx} to avoid that it is
% picked up by |\fromany| by mistake.
% \changes{1.929}{2005/01/12}{The \texttt{afm-name} string usually has
% a value at this point, so it is necessary to reset it. (LH,
% sighing because he knows this isn't the first time this problem
% occurred) First to be hit by this bug was Michael Zedler.}
% \begin{macrocode}
\def\metrics_given_encoding#1#2{
\x_cs\edef{s-afm-name}{#1-#2}
\if_file_exists{#1.pl}\then
\generalpltomtx{#1}{#1-#2}{pl}{#2}
\else
\if_file_exists{#1.vpl}\then
\generalpltomtx{#1}{#1-#2}{vpl}{#2}
\else
\unsetstr{afm-name}
\fi\fi
}
% \end{macrocode}
% \end{macro}
%
%
% \definechange{option-keyword}{1.924}{2002/02/16}{Added mechanism
% for passing options to MTX and ETX files. (LH)}
%
% \begin{macro}{\reset_modifiers_hook}
% The |\reset_modifiers_hook| macro contains code that initialises
% all parameters that are modified by some \meta{modifier clause} to
% their default values. If you need to add some initialisations due
% to that you define additional keywords then you should append
% these initialisations to this macro.
% \usechange{option-keyword}
% \begin{macrocode}
\def\reset_modifiers_hook{
\unsetint{rawscale}
\let\glyph_name_modifier\identity_one
\let\pl_encoding\empty_command
\let\list_of_options\empty_command
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\get_file_name}
% The macro |\get_file_name| grabs the base font (or other MTX file)
% name and starts the processing of the \meta{optional modifiers}.
% \begin{macrocode}
\def\get_file_name #1~{
\edef\file_name{#1}
\get_keyword
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\get_keyword}
% \begin{macro}{\gobble_keywords}
% The |\get_keyword| macro expects to be expanded in the context
% \begin{quote}
% |\get_keyword|\,\meta{keyword}\verb*" "
% \end{quote}
% where the \meta{keyword} is a possible keyword. If
% |\IFKW-|\meta{keyword} is defined then the above expands to it,
% otherwise the above expands to an error message followed by a
% |\gobble_keywords|, which will gobble the rest of the list of
% keywords and arguments.
% \begin{macrocode}
\def\get_keyword #1~{
\if_defined{IFKW-#1}\then
\csname IFKW-#1 \expandafter\endcsname
\else
\fontinsterror{\string\install...}{
`#1'~is~not~a~defined~keyword
}{
\error_help_a\messagebreak
Extra~tokens~will~be~flushed.
}
\expandafter\gobble_keywords
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\gobble_keywords#1\par{}
% \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\IFKW-}
% The empty keyword is used to flag the end of the \meta{optional
% modifiers}.
% \begin{macrocode}
\x_cs\let{IFKW-}=\gobble_keywords
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IFKW-scaled}
% This macro handles grabbing the argument of the traditional
% \texttt{scaled} keyword.
% \changes{1.900}{1999/02/05}{Changed \cs{setint} to \cs{resetint}.
% (LH)}
% \begin{macrocode}
\x_cs\def{IFKW-scaled}#1~{
\ifnum #1=\one_thousand
\unsetint{rawscale}
\else
\x_resetint{rawscale}{#1}
\fi
\get_keyword
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IFKW-suffix}
% This macro handles grabbing the argument of the \texttt{suffix}
% keyword. The effect of `\texttt{suffix} \meta{suffix}' is that
% \meta{suffix} will be appended to the name of every glyph defined
% by the next MTX file to be read in.
% \begin{macrocode}
\x_cs\def{IFKW-suffix}#1~{
\def\glyph_name_modifier##1{##1#1}
\get_keyword
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IFKW-encoding}
% \begin{macro}{\pl_encoding}
% This macro handles grabbing the argument of the \texttt{encoding}
% keyword. The effect of `\texttt{encoding} \meta{etx}' is that
% \meta{etx} will be used as encoding when converting a PL or VPL
% file to MTX. |\pl_encoding| is used for storing the argument
% value. Its expansion is normally empty, which means |\fromafm|
% handles locating the metrics file and the encoding used for a PL
% or VPL is determined by its codingscheme.
% \begin{macrocode}
\x_cs\def{IFKW-encoding}#1~{
\def\pl_encoding{#1}
\get_keyword
}
\let\pl_encoding=\empty_command
% \end{macrocode}
% \end{macro}\end{macro}
%
%
% \begin{macro}{\IFKW-option}
% This macro handles grabbing the argument of the \texttt{option}
% keyword. One can test using |\ifoption| whether a particular option
% was specified.
% \usechange{option-keyword}
% \begin{macrocode}
\x_cs\def{IFKW-option}#1~{
\add_to\list_of_options{\do{#1}}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifoption}
% \usechange{option-keyword}
% \begin{macro}{\list_of_options}
% \usechange{option-keyword}
% The |\ifoption| command is used to test whether a particular option
% is present on the list of options. The syntax is
% \begin{quote}
% |\ifoption|\marg{string}|\then|
% \end{quote}
% and it is tested whether the \meta{string} was one of the options
% given. Like strings in general, the \meta{string} is expanded
% before it is compared to the options listed in |\list_of_options|.
%
% The |\list_of_options| is a sequence of items on the form
% \begin{quote}
% |\do|\marg{option}
% \end{quote}
% where each \meta{option} is an already expanded string of
% characters.
% \begin{macrocode}
\def\ifoption#1\then{
\_a_false
\edef\a_macro{#1}
\def\do##1{
\if_a_ \else
\def\b_macro{##1}
\ifx \a_macro\b_macro \_a_true \fi
\fi
}
\list_of_options
\if_a_
}
%</pkg>
%<*doc>
\def\ifoption#1\then{%
\generic@if{option \TypesetStringExpression{#1}}%
}
%</doc>
%<*pkg>
\let\list_of_options\empty_command
% \end{macrocode}
% \end{macro}\end{macro}
%
%
% \subsection{Writing font definition files}
%
% \begin{macro}{\fd_family}
% |\fd_family{ENCODING}{FAMILY}{FD-COMMANDS}|
%
% Writes out an |.fd| file for the specified |ENCODING| and |FAMILY|
% processing the accumulated information and default substitutions.
%
% \begin{macrocode}
\def\fd_family#1#2#3{
\a_toks{#3}
\edef\lowercase_file{\lowercase{
\edef\noexpand\lowercase_file{#1#2.fd}}}
\lowercase_file
\open_out{\lowercase_file}
\out_line{\percent_char~Filename:~\lowercase_file}
\out_line{\percent_char~Created~by:~tex~\jobname}
\out_line{\percent_char~Created~using~fontinst~v\fontinstversion}
\out_line{}
\out_line{\percent_char~THIS~FILE~SHOULD~BE~PUT~IN~A~TEX~INPUTS~
DIRECTORY}
\out_line{}
\out_line{\string\ProvidesFile{\lowercase_file}}
\out_lline{[
\the\year/
\ifnum10>\month0\fi\the\month/
\ifnum10>\day0\fi\the\day\space
Fontinst~v\fontinstversion\space
font~definitions~for~#1/#2.
]}
\out_line{}
\out_line{\string\DeclareFontFamily{#1}{#2}{\the\a_toks}}
{
\csname #1-#2\endcsname
\out_line{}
\let\do_shape=\substitute_shape
\csname #1-#2\endcsname
\let\do_shape=\remove_shape
\csname #1-#2\endcsname
}
\x_cs\g_let{#1-#2}\x_relax
\out_line{}
\out_line{\string\endinput}
\close_out{Font~definitions}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fd_shape}
% |\fd_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
%
% \begin{macrocode}
\def\fd_shape#1#2#3#4{
\out_line{}
\out_line{\string\DeclareFontShape{#1}{#2}{#3}{#4}\left_brace_char}
\csname #1-#2-#3-#4\endcsname
\x_cs\g_let{#1-#2-#3-#4}\empty_command
\out_line{\right_brace_char{}}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fd_size}
% |\fd_size{SIZE}{FONT-NAME}|
%
% \begin{macrocode}
\def\fd_size#1#2{
\x_cs\ifx{siz-#1}\x_relax
\out_lline{#1~#2}
\else
\out_lline{\csname siz-#1\endcsname\space #2}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\remove_shape}
% |\remove_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
%
% \begin{macrocode}
\def\remove_shape#1#2#3#4{
\x_cs\g_let{#1-#2-#3-#4}\x_relax
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\substitute_shape}
% |\substitute_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
%
% \begin{macrocode}
\def\substitute_shape#1#2#3#4{
\edef\orig_shape{#4}
\substitute_series{#1}{#2}{#3}{\orig_shape}
\x_cs\ifx{sub-\orig_shape}\x_relax\else
\edef\subst_shape{\csname sub-\orig_shape\endcsname}
\x_cs\ifx{#1-#2-#3-\subst_shape}\x_relax
\out_line{
\string\DeclareFontShape{#1}{#2}{#3}{\subst_shape}{
<->\csname typ-\orig_shape\endcsname\space
*~#2/#3/\orig_shape
}{}
}
\x_cs\let{#1-#2-#3-\subst_shape}\empty_command
\substitute_shape{#1}{#2}{#3}{\subst_shape}
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\substitute_series}
% |\substitute_series{ENCODING}{FAMILY}{SERIES}{SHAPE}|
%
% \begin{macrocode}
\def\substitute_series#1#2#3#4{
\edef\orig_series{#3}
\x_cs\ifx{sub-\orig_series}\x_relax\else
\edef\subst_series{\csname sub-\orig_series\endcsname}
\x_cs\ifx{#1-#2-\subst_series-#4}\x_relax
\out_line{
\string\DeclareFontShape{#1}{#2}{\subst_series}{#4}{
<->\csname typ-\orig_series\endcsname\space
*~#2/\orig_series/#4
}{}
}
\x_cs\let{#1-#2-\subst_series-#4}\empty_command
\substitute_series{#1}{#2}{\subst_series}{#4}
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\substitutesilent}
% \begin{macro}{\substitutenoisy}
% |\substitutesilent{TO}{FROM}|\\
% |\substitutenoisy{TO}{FROM}|
%
% Specifies a default substitution for family or shape |TO|,
% which is substituted by family or shape |FROM|.
%
% \begin{macrocode}
\def\substitutesilent#1#2{
\x_cs\def{sub-#2}{#1}
\x_cs\def{typ-#2}{ssub}
}
\def\substitutenoisy#1#2{
\x_cs\def{sub-#2}{#1}
\x_cs\def{typ-#2}{sub}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\substitutesilent{bx}{b}
\substitutesilent{b}{bx}
\substitutesilent{b}{sb}
\substitutesilent{b}{db}
\substitutesilent{m}{mb}
\substitutesilent{m}{l}
% \end{macrocode}
% \begin{macrocode}
\substitutenoisy{ui}{it}
% \end{macrocode}
%
% I don't think we want these since in OT1 encoding it will
% cause the old |<sterling>| vs |<dollar>| problem. (ASAJ)
% --- Oh yes we do. (SPQR)
%
% \begin{macrocode}
\substitutesilent{sl}{it}
\substitutesilent{it}{sl}
% \end{macrocode}
%
%
% \subsection{The font substitution mechanism}
%
% \textbf{Note:} This subsection contains (part of) a new implementation
% of the font substitution mechanism, but it is uncertain whether it
% will ever be completed.
% \begin{macrocode}
%<*underconstruction>
% \end{macrocode}
%
%
% \subsubsection{The substitution graph}
%
% Which substitutions are performed are determined by the substitution
% graph. The vertices of this graph are all combinations of a series and
% a shape. The arcs (directed edges) of this graph are the substitutions
% that can be made. Each arc has a wheight---a real number in the range
% $[0,1]$---that describes how much of the quality of the font that is
% preserved with this substitution.
%
% As an example, consider the case that there is an arc from \texttt{m/it}
% to \texttt{m/sl} and that the wheight of this arc is $0.5$. This means
% that it is OK to substitute the medium italic (\texttt{m/it}) font as a
% medium slanted (\texttt{m/sl}) font if there is no medium slanted font,
% but that the medium italic font is only considered as being half
% ($0.5$) as good a medium slanted font as it is a medium italic font.
%
% The main problem the substitution mechanism has to solve in this
% context is to find the best possible way of substituting a font, given
% the real fonts which has actually been installed (using |\installfont|
% or |\installrawfont|). The solution to this problem is computed by a
% brute force approach---all possible substitution paths are followed
% and during this process the best solution so far, for each vertex
% separately, is stored.
% \medskip
%
% In practice, the substitution graph $G$ is constructed as the cartesian
% product of one graph $G\sb{1}$ of series substitutions and one graph
% $G\sb{2}$ of shape substitutions, with the option of adding some
% additional arcs to this product. The reason for this is that one
% usually wants to make the same shape substitutions in all series and
% vice versa, so by only storing the $G\sb{1}$ and $G\sb{2}$ graphs, plus
% perhaps a handfull of extra edges, one gets away with using fewer
% tokens.
% The wheights of the arcs are stored as integers in the range 0--1000,
% where 0 means the real number $0$ and 1000 means the real number $1$.
% \medskip
%
% \DescribeMacro\do_arc
% The |\do_arc| macro is probably the most common in the data
% structures that constitute the substitution graph. Its syntax is
% always
% \begin{quote}
% |\do_arc|\marg{series}\marg{shape}\marg{wheight}
% \end{quote}
% but it is meant to be redefined whenever one needs to do something
% ``for all arcs'' (usually all arcs at a given vertex or so). There are
% three families of macros which consist of |\do_arc| lists, namely
% \begin{quote}
% |\sub1-|\meta{series}\\
% |\sub2-|\meta{shape}\\
% |\sub-|\meta{series}|-|\meta{shape}
% \end{quote}
% These macros store arcs going out from a vertex. The
% |\sub1-|\meta{series} macross store the arcs incident with the vertex
% \meta{series} in the series substitution graph $G\sb{1}$. The
% |\sub2-|\meta{shape} macros store the arcs incident with the vertex
% \meta{shape} in the shape substitution graph $G\sb{2}$. The
% |\sub-|\meta{series}|-|\meta{shape} macros store the arcs of $G$ that
% are incident with the vertex \meta{series}|/|\meta{shape} but do
% \emph{not} appear in the cartesian product $G\sb{1} \times G\sb{2}$.
%
% The \meta{series} and \meta{shape} arguments of |\do_arc| tells which
% vertex the arc goes to, hence for example |\do_arc{b}{it}{600}| in the
% macro |\sub-db-sl| corresponds to an arc going from the |db/sl| vertex
% to the |b/it| vertex and having a wheight of $0.6$.
%
% \DescribeMacro\curr_series
% \DescribeMacro\curr_shape
% The above omits one important detail, namely that the \meta{shape}
% argument for a |\do_arc| in a |\sub1-|\textellipsis\ must be able to
% be \emph{all} shapes since the shape is not determined for arcs in
% $G\sb{1}$ and the series is likewise for arcs in $G\sb{2}$. To make things
% work anyway, there are two macros |\curr_series| and |\curr_shape|
% which contain this missing information. Furthermore, a |\do_arc| item
% for an arc in $G\sb{1}$ will always have the structure
% \begin{quote}
% |\do_arc|\marg{series}|\curr_shape|\marg{wheight}
% \end{quote}
% and a |\do_arc| item for an arc in $G\sb{2}$ will have the structure
% \begin{quote}
% |\do_arc\curr_series|\marg{shape}\marg{wheight}
% \end{quote}
%
%
% \begin{macro}{\substituteshape}
% \begin{macro}{\substituteseries}
% \begin{macro}{\substituteseriesshape}
% |\substituteshape|\marg{to}\marg{from}\marg{wheight}\\
% |\substituteseries|\marg{to}\marg{from}\marg{wheight}\\
% |\substituteseriesshape|\marg{toseries}\marg{toshape}^^A
% \marg{fromseries}\marg{fromshape}\marg{wheight}
%
% \begin{macrocode}
\def\substituteshape#1#2#3{
\round_wheight{#3}
\edef\temp_command{#1}
\edef\sub_suffix{#2}
\ifx \temp_command\sub_suffix \else
\def\sub_suffix##1##2{2-##2}
\def\do_arc##1##2##3{
\x_cs\ifx{sub2-##2}R \else
\noexpand\do_arc\noexpand\curr_series{##2}{##3}
\fi
}
\update_do_arc_list{}{#2}{}{#1}{\noexpand\curr_series{#1}}
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\substituteseries#1#2#3{
\round_wheight{#3}
\edef\temp_command{#1}
\edef\sub_suffix{#2}
\ifx \temp_command\sub_suffix \else
\def\sub_suffix##1##2{1-##1}
\def\do_arc##1##2##3{
\x_cs\ifx{sub1-##1}R \else
\noexpand\do_arc{##1}\noexpand\curr_shape{##3}
\fi
}
\update_do_arc_list{#2}{}{#1}{}{{#1}\noexpand\curr_shape}
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\substituteseriesshape#1#2#3#4#5{
\round_wheight{#5}
\edef\temp_command{#1-#2}
\edef\sub_suffix{#3-#4}
\ifx \temp_command\sub_suffix \else
\def\sub_suffix##1##2{-##1-##2}
\def\do_arc##1##2##3{
\x_cs\ifx{sub-##1-##2}R \else
\noexpand\do_arc{##1}{##2}{##3}
\fi
}
\update_do_arc_list{#3}{#4}{#1}{#2}{{#1}{#2}}
\fi
}
% \end{macrocode}
% \begin{macrocode}
\def\round_wheight#1{
\eval_expr{#1}
\ifnum \one_thousand<\result
\result=\one_thousand
\else \ifnum 0>\result
\result=\z@
\fi\fi
}
% \end{macrocode}
%
% |\update_do_arc_list|\marg{update-series}\marg{update-shape}^^A
% \allowbreak\marg{tag-series}\allowbreak\marg{tag-shape}^^A
% \allowbreak\marg{inserted series+shape}
%
% \begin{macrocode}
\def\update_do_arc_list#1#2#3#4#5{
\bgroup
\edef\temp_command{sub\sub_suffix{#1}{#2}}
\x_cs\let{sub\sub_suffix{#3}{#4}}=R
\x_cs\xdef\temp_command{
\x_cs\ifx\temp_command\relax \else
\csname\temp_command\endcsname
\fi
\ifnum 0<\result
\noexpand\do_arc #5{\the\result}
\fi
}
\egroup
}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
%
%
% \begin{macro}{\substitutesilent}
% \begin{macro}{\substitutenoisy}
% |\substitutesilent{TO}{FROM}|\\
% |\substitutenoisy{TO}{FROM}|
%
% Specifies a default substitution for family or shape |TO|,
% which is substituted by family or shape |FROM|.
%
% \begin{macrocode}
\def\substitutesilent#1#2{
\substituteseries{#1}{#2}{900}
\substituteshape{#1}{#2}{900}
}
\def\substitutenoisy#1#2{
\substituteseries{#1}{#2}{500}
\substituteshape{#1}{#2}{500}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\a_count=900 % Silent substitution wheight
\b_count=500 % Noisy substitution wheight
\substituteseries{bx}{b}{\a_count}
\substituteseries{b}{bx}{\a_count}
\substituteseries{b}{sb}{\a_count}
\substituteseries{b}{db}{\a_count}
\substituteseries{m}{mb}{\a_count}
\substituteseries{m}{l}{\a_count}
% \end{macrocode}
% \begin{macrocode}
\substituteshape{ui}{it}{\b_count}
% \end{macrocode}
%
% I don't think we want these since in OT1 encoding it will
% cause the old |<sterling>| vs |<dollar>| problem. (ASAJ)
% --- Oh yes we do. (SPQR)
%
% \begin{macrocode}
\substituteshape{sl}{it}{\a_count}
\substituteshape{it}{sl}{\a_count}
% \end{macrocode}
%
%
% \subsubsection{Listing reachable vertices}
%
% While determining the optimal substitutions, there is a need to store
% some---more or less temporary---information for each vertex. Such
% information will be called a \emph{property} of the vertex and it is
% stored in the |\v-|\meta{series}|-|\meta{shape} family of macros.
%
% The following are the basic properties:
% \begin{list}{}{^^A
% ^^A How does one make the label go on a line of its own??
% }
% \item[\cs{real_font}\marg{quality}]
% This expresses that this vertex corresponds to a font that has
% actually been installed with a nominal quality of \meta{quality}.
% \item[\cs{subs_font}\marg{series}\marg{shape}\marg{quality}]
% This expresses that this vertex corresponds to a font for which
% the font \meta{series}|/|\meta{shape} has been substituted.
% \meta{quality} is the quality this substitution is considered to
% have.
% \item
% \end{list}
%
%
% There will also be some lists of vertices. These will consist of simple
% |\do|\marg{series}\marg{shape} triples.
%
% \begin{macrocode}
\def\list_subs_vertices{
\def\subs_vertex_list{}
\let\do_arc=\subs_do_arc
\let\do=\never_do
\def\real_font##1{\c_count=\@MM}
\def\subs_font##1##2##3{\c_count=##3\relax}
\real_vertex_list
}
\def\subs_do_arc#1#2#3{
\b_count=#3
\multiply \b_count \a_count
\divide \b_count \one_thousand
\c_count=-\max_mathchardef
\csname v-#1-#2\endcsname
\ifnum \c_count<\b_count
\ifnum \c_count=-\max_mathchardef
\edef\subs_vertex_list{\subs_vertex_list\do{#1}{#2}}
\fi
\x_cs\edef{v-#1-#2}{\noexpand\subs_font{\subs_series}
{\subs_shape}{\the\b_count}}
\toks_a=\expandafter{\the\a_toks \do_subs{#1}{#2}}
\fi
}
\def\do_subs#1#2{
\edef\curr_series{#1}
\edef\curr_shape{#2}
\csname v-#1-#2\endcsname
\a_count=\c_count
\a_toks={}
\csname sub-#1-#2\endcsname
\csname sub1-#1\endcsname
\csname sub2-#2\endcsname
\the\a_toks
}
\def\start_subs_at#1#2{
\edef\subs_series{#1} \let\curr_series=\subs_series
\edef\subs_shape{#2} \let\curr_shape=\subs_shape
\a_count=\x_cs\second_of_two{v-#1-#2}
\a_toks={}
\csname sub-#1-#2\endcsname
\csname sub1-#1\endcsname
\csname sub2-#2\endcsname
\the\a_toks
}
% \end{macrocode}
%
%
% \begin{macrocode}
%</underconstruction>
% \end{macrocode}
%
%
% \subsection{Default encodings and font sizes}
%
% \begin{macro}{\declareencoding}
% |\declareencoding{CODINGSCHEME}{ENCODING}|
%
% Declare a macro |\enc-CODINGSCHEME| which expands to |ENCODING|.
% This is used to determine the encoding in |\pltomtx|.
% \changes{1.927}{2004/07/31}{Lowercased encoding file names. (LH)}
%
% \begin{macrocode}
\def\declareencoding#1#2{\x_cs\edef{enc-#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% Old \TeX{} text font encodings.
% \begin{macrocode}
\declareencoding{TEX~TEXT}{ot1}
\declareencoding{TEX~TEXT~WITHOUT~F-LIGATURES}{ot1}
\declareencoding{TEX~TYPEWRITER~TEXT}{ot1tt}
% \end{macrocode}
%
% Old \TeX{} math font encodings.
% \begin{macrocode}
\declareencoding{TEX~MATH~ITALIC}{oml}
\declareencoding{TEX~MATH~SYMBOLS}{oms}
\declareencoding{TEX~MATH~EXTENSION}{omx}
\declareencoding{LATEX~SYMBOLS}{lasy}
% \end{macrocode}
%
% Euler math font encodings.
% \begin{macrocode}
\declareencoding{TEX~TEXT~SUBSET}{eufrak}
\declareencoding{TEX~MATH~ITALIC~SUBSET}{eurm}
\declareencoding{TEX~MATH~SYMBOLS~SUBSET}{euscr}
\declareencoding{EULER~SUBSTITUTIONS~ONLY}{euex}
% \end{macrocode}
%
% New \TeX{} text font encodings.
% \begin{macrocode}
\declareencoding{EXTENDED~TEX~FONT~ENCODING~-~LATIN}{t1}
\declareencoding{TEX~TEXT~COMPANION~SYMBOLS~1---TS1}{ts1}
% \end{macrocode}
%
% Rencoded PostScript font encdings.
% \begin{macrocode}
\declareencoding{TEXBASE1ENCODING}{8r}
\declareencoding{TEX~TYPEWRITER~AND~WINDOWS~ANSI}{8y}
% \end{macrocode}
%
% \begin{macro}{\declaresize}
% |\declaresize{FONTSIZE}{LATEXSIZE}|
%
% \begin{macrocode}
\def\declaresize#1#2{\x_cs\edef{siz-#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% Default sizes. An empty size argument is equivalent to |<->|,
% for use with scalable fonts.
%
% \begin{macrocode}
\declaresize{}{<->}
\declaresize{5}{<5>}
\declaresize{6}{<6>}
\declaresize{7}{<7>}
\declaresize{8}{<8>}
\declaresize{9}{<9>}
\declaresize{10}{<10>}
\declaresize{11}{<10.95>}
\declaresize{12}{<12>}
\declaresize{14}{<14.4>}
\declaresize{17}{<17.28>}
\declaresize{20}{<20.74>}
\declaresize{25}{<24.88>}
% \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{Debugging}
%
% \begin{macro}{\NOFILES}
% |\NOFILES| switches off file generation, and causes
% \package{fontinst} to only generate empty files. It only affects the
% user level commands, so it is primarily of use when debugging
% commands that build on these, such as for example the
% |\latin|\-|family| command.
% \changes{1.914}{2000/05/20}{Added \cs{reglyphfont}. (LH)}
% \begin{macrocode}
\def\NOFILES{
\def\transformfont##1##2{
\touch_file{##1.mtx}
\touch_file{##1.pl}
}
\def\reglyphfont##1##2{\touch_file{##1.mtx}}
\def\installfonts{}
\def\endinstallfonts{}
\def\installfont##1##2##3##4##5##6##7##8{
\touch_file{##1.vpl}
}
\def\installrawfont##1##2##3##4##5##6##7##8{
\touch_file{##1.pl}
}
\def\installfamily##1##2##3{\touch_file{##1##2.fd}}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\touch_file}
% \begin{macrocode}
\def\touch_file#1{
\edef\lowercase_file{\lowercase{
\edef\noexpand\lowercase_file{#1}}}
\lowercase_file
\open_out{\lowercase_file}
\out_line{\percent_char~TEST~FILE.}
\out_line{\percent_char~Created~whilst~debugging~fontinst.}
\close_out{Test~file}
}
%</pkg>
% \end{macrocode}
% \end{macro}
%
% \Finale
\endinput
|