summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaotfload/fontloader-2022-02-24.lua
blob: aee123be032d702aa71f5cbd3d02948636ba3af8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
26580
26581
26582
26583
26584
26585
26586
26587
26588
26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599
26600
26601
26602
26603
26604
26605
26606
26607
26608
26609
26610
26611
26612
26613
26614
26615
26616
26617
26618
26619
26620
26621
26622
26623
26624
26625
26626
26627
26628
26629
26630
26631
26632
26633
26634
26635
26636
26637
26638
26639
26640
26641
26642
26643
26644
26645
26646
26647
26648
26649
26650
26651
26652
26653
26654
26655
26656
26657
26658
26659
26660
26661
26662
26663
26664
26665
26666
26667
26668
26669
26670
26671
26672
26673
26674
26675
26676
26677
26678
26679
26680
26681
26682
26683
26684
26685
26686
26687
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715
26716
26717
26718
26719
26720
26721
26722
26723
26724
26725
26726
26727
26728
26729
26730
26731
26732
26733
26734
26735
26736
26737
26738
26739
26740
26741
26742
26743
26744
26745
26746
26747
26748
26749
26750
26751
26752
26753
26754
26755
26756
26757
26758
26759
26760
26761
26762
26763
26764
26765
26766
26767
26768
26769
26770
26771
26772
26773
26774
26775
26776
26777
26778
26779
26780
26781
26782
26783
26784
26785
26786
26787
26788
26789
26790
26791
26792
26793
26794
26795
26796
26797
26798
26799
26800
26801
26802
26803
26804
26805
26806
26807
26808
26809
26810
26811
26812
26813
26814
26815
26816
26817
26818
26819
26820
26821
26822
26823
26824
26825
26826
26827
26828
26829
26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
26845
26846
26847
26848
26849
26850
26851
26852
26853
26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
26868
26869
26870
26871
26872
26873
26874
26875
26876
26877
26878
26879
26880
26881
26882
26883
26884
26885
26886
26887
26888
26889
26890
26891
26892
26893
26894
26895
26896
26897
26898
26899
26900
26901
26902
26903
26904
26905
26906
26907
26908
26909
26910
26911
26912
26913
26914
26915
26916
26917
26918
26919
26920
26921
26922
26923
26924
26925
26926
26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
26939
26940
26941
26942
26943
26944
26945
26946
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960
26961
26962
26963
26964
26965
26966
26967
26968
26969
26970
26971
26972
26973
26974
26975
26976
26977
26978
26979
26980
26981
26982
26983
26984
26985
26986
26987
26988
26989
26990
26991
26992
26993
26994
26995
26996
26997
26998
26999
27000
27001
27002
27003
27004
27005
27006
27007
27008
27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
27022
27023
27024
27025
27026
27027
27028
27029
27030
27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
27043
27044
27045
27046
27047
27048
27049
27050
27051
27052
27053
27054
27055
27056
27057
27058
27059
27060
27061
27062
27063
27064
27065
27066
27067
27068
27069
27070
27071
27072
27073
27074
27075
27076
27077
27078
27079
27080
27081
27082
27083
27084
27085
27086
27087
27088
27089
27090
27091
27092
27093
27094
27095
27096
27097
27098
27099
27100
27101
27102
27103
27104
27105
27106
27107
27108
27109
27110
27111
27112
27113
27114
27115
27116
27117
27118
27119
27120
27121
27122
27123
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134
27135
27136
27137
27138
27139
27140
27141
27142
27143
27144
27145
27146
27147
27148
27149
27150
27151
27152
27153
27154
27155
27156
27157
27158
27159
27160
27161
27162
27163
27164
27165
27166
27167
27168
27169
27170
27171
27172
27173
27174
27175
27176
27177
27178
27179
27180
27181
27182
27183
27184
27185
27186
27187
27188
27189
27190
27191
27192
27193
27194
27195
27196
27197
27198
27199
27200
27201
27202
27203
27204
27205
27206
27207
27208
27209
27210
27211
27212
27213
27214
27215
27216
27217
27218
27219
27220
27221
27222
27223
27224
27225
27226
27227
27228
27229
27230
27231
27232
27233
27234
27235
27236
27237
27238
27239
27240
27241
27242
27243
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
27260
27261
27262
27263
27264
27265
27266
27267
27268
27269
27270
27271
27272
27273
27274
27275
27276
27277
27278
27279
27280
27281
27282
27283
27284
27285
27286
27287
27288
27289
27290
27291
27292
27293
27294
27295
27296
27297
27298
27299
27300
27301
27302
27303
27304
27305
27306
27307
27308
27309
27310
27311
27312
27313
27314
27315
27316
27317
27318
27319
27320
27321
27322
27323
27324
27325
27326
27327
27328
27329
27330
27331
27332
27333
27334
27335
27336
27337
27338
27339
27340
27341
27342
27343
27344
27345
27346
27347
27348
27349
27350
27351
27352
27353
27354
27355
27356
27357
27358
27359
27360
27361
27362
27363
27364
27365
27366
27367
27368
27369
27370
27371
27372
27373
27374
27375
27376
27377
27378
27379
27380
27381
27382
27383
27384
27385
27386
27387
27388
27389
27390
27391
27392
27393
27394
27395
27396
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418
27419
27420
27421
27422
27423
27424
27425
27426
27427
27428
27429
27430
27431
27432
27433
27434
27435
27436
27437
27438
27439
27440
27441
27442
27443
27444
27445
27446
27447
27448
27449
27450
27451
27452
27453
27454
27455
27456
27457
27458
27459
27460
27461
27462
27463
27464
27465
27466
27467
27468
27469
27470
27471
27472
27473
27474
27475
27476
27477
27478
27479
27480
27481
27482
27483
27484
27485
27486
27487
27488
27489
27490
27491
27492
27493
27494
27495
27496
27497
27498
27499
27500
27501
27502
27503
27504
27505
27506
27507
27508
27509
27510
27511
27512
27513
27514
27515
27516
27517
27518
27519
27520
27521
27522
27523
27524
27525
27526
27527
27528
27529
27530
27531
27532
27533
27534
27535
27536
27537
27538
27539
27540
27541
27542
27543
27544
27545
27546
27547
27548
27549
27550
27551
27552
27553
27554
27555
27556
27557
27558
27559
27560
27561
27562
27563
27564
27565
27566
27567
27568
27569
27570
27571
27572
27573
27574
27575
27576
27577
27578
27579
27580
27581
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592
27593
27594
27595
27596
27597
27598
27599
27600
27601
27602
27603
27604
27605
27606
27607
27608
27609
27610
27611
27612
27613
27614
27615
27616
27617
27618
27619
27620
27621
27622
27623
27624
27625
27626
27627
27628
27629
27630
27631
27632
27633
27634
27635
27636
27637
27638
27639
27640
27641
27642
27643
27644
27645
27646
27647
27648
27649
27650
27651
27652
27653
27654
27655
27656
27657
27658
27659
27660
27661
27662
27663
27664
27665
27666
27667
27668
27669
27670
27671
27672
27673
27674
27675
27676
27677
27678
27679
27680
27681
27682
27683
27684
27685
27686
27687
27688
27689
27690
27691
27692
27693
27694
27695
27696
27697
27698
27699
27700
27701
27702
27703
27704
27705
27706
27707
27708
27709
27710
27711
27712
27713
27714
27715
27716
27717
27718
27719
27720
27721
27722
27723
27724
27725
27726
27727
27728
27729
27730
27731
27732
27733
27734
27735
27736
27737
27738
27739
27740
27741
27742
27743
27744
27745
27746
27747
27748
27749
27750
27751
27752
27753
27754
27755
27756
27757
27758
27759
27760
27761
27762
27763
27764
27765
27766
27767
27768
27769
27770
27771
27772
27773
27774
27775
27776
27777
27778
27779
27780
27781
27782
27783
27784
27785
27786
27787
27788
27789
27790
27791
27792
27793
27794
27795
27796
27797
27798
27799
27800
27801
27802
27803
27804
27805
27806
27807
27808
27809
27810
27811
27812
27813
27814
27815
27816
27817
27818
27819
27820
27821
27822
27823
27824
27825
27826
27827
27828
27829
27830
27831
27832
27833
27834
27835
27836
27837
27838
27839
27840
27841
27842
27843
27844
27845
27846
27847
27848
27849
27850
27851
27852
27853
27854
27855
27856
27857
27858
27859
27860
27861
27862
27863
27864
27865
27866
27867
27868
27869
27870
27871
27872
27873
27874
27875
27876
27877
27878
27879
27880
27881
27882
27883
27884
27885
27886
27887
27888
27889
27890
27891
27892
27893
27894
27895
27896
27897
27898
27899
27900
27901
27902
27903
27904
27905
27906
27907
27908
27909
27910
27911
27912
27913
27914
27915
27916
27917
27918
27919
27920
27921
27922
27923
27924
27925
27926
27927
27928
27929
27930
27931
27932
27933
27934
27935
27936
27937
27938
27939
27940
27941
27942
27943
27944
27945
27946
27947
27948
27949
27950
27951
27952
27953
27954
27955
27956
27957
27958
27959
27960
27961
27962
27963
27964
27965
27966
27967
27968
27969
27970
27971
27972
27973
27974
27975
27976
27977
27978
27979
27980
27981
27982
27983
27984
27985
27986
27987
27988
27989
27990
27991
27992
27993
27994
27995
27996
27997
27998
27999
28000
28001
28002
28003
28004
28005
28006
28007
28008
28009
28010
28011
28012
28013
28014
28015
28016
28017
28018
28019
28020
28021
28022
28023
28024
28025
28026
28027
28028
28029
28030
28031
28032
28033
28034
28035
28036
28037
28038
28039
28040
28041
28042
28043
28044
28045
28046
28047
28048
28049
28050
28051
28052
28053
28054
28055
28056
28057
28058
28059
28060
28061
28062
28063
28064
28065
28066
28067
28068
28069
28070
28071
28072
28073
28074
28075
28076
28077
28078
28079
28080
28081
28082
28083
28084
28085
28086
28087
28088
28089
28090
28091
28092
28093
28094
28095
28096
28097
28098
28099
28100
28101
28102
28103
28104
28105
28106
28107
28108
28109
28110
28111
28112
28113
28114
28115
28116
28117
28118
28119
28120
28121
28122
28123
28124
28125
28126
28127
28128
28129
28130
28131
28132
28133
28134
28135
28136
28137
28138
28139
28140
28141
28142
28143
28144
28145
28146
28147
28148
28149
28150
28151
28152
28153
28154
28155
28156
28157
28158
28159
28160
28161
28162
28163
28164
28165
28166
28167
28168
28169
28170
28171
28172
28173
28174
28175
28176
28177
28178
28179
28180
28181
28182
28183
28184
28185
28186
28187
28188
28189
28190
28191
28192
28193
28194
28195
28196
28197
28198
28199
28200
28201
28202
28203
28204
28205
28206
28207
28208
28209
28210
28211
28212
28213
28214
28215
28216
28217
28218
28219
28220
28221
28222
28223
28224
28225
28226
28227
28228
28229
28230
28231
28232
28233
28234
28235
28236
28237
28238
28239
28240
28241
28242
28243
28244
28245
28246
28247
28248
28249
28250
28251
28252
28253
28254
28255
28256
28257
28258
28259
28260
28261
28262
28263
28264
28265
28266
28267
28268
28269
28270
28271
28272
28273
28274
28275
28276
28277
28278
28279
28280
28281
28282
28283
28284
28285
28286
28287
28288
28289
28290
28291
28292
28293
28294
28295
28296
28297
28298
28299
28300
28301
28302
28303
28304
28305
28306
28307
28308
28309
28310
28311
28312
28313
28314
28315
28316
28317
28318
28319
28320
28321
28322
28323
28324
28325
28326
28327
28328
28329
28330
28331
28332
28333
28334
28335
28336
28337
28338
28339
28340
28341
28342
28343
28344
28345
28346
28347
28348
28349
28350
28351
28352
28353
28354
28355
28356
28357
28358
28359
28360
28361
28362
28363
28364
28365
28366
28367
28368
28369
28370
28371
28372
28373
28374
28375
28376
28377
28378
28379
28380
28381
28382
28383
28384
28385
28386
28387
28388
28389
28390
28391
28392
28393
28394
28395
28396
28397
28398
28399
28400
28401
28402
28403
28404
28405
28406
28407
28408
28409
28410
28411
28412
28413
28414
28415
28416
28417
28418
28419
28420
28421
28422
28423
28424
28425
28426
28427
28428
28429
28430
28431
28432
28433
28434
28435
28436
28437
28438
28439
28440
28441
28442
28443
28444
28445
28446
28447
28448
28449
28450
28451
28452
28453
28454
28455
28456
28457
28458
28459
28460
28461
28462
28463
28464
28465
28466
28467
28468
28469
28470
28471
28472
28473
28474
28475
28476
28477
28478
28479
28480
28481
28482
28483
28484
28485
28486
28487
28488
28489
28490
28491
28492
28493
28494
28495
28496
28497
28498
28499
28500
28501
28502
28503
28504
28505
28506
28507
28508
28509
28510
28511
28512
28513
28514
28515
28516
28517
28518
28519
28520
28521
28522
28523
28524
28525
28526
28527
28528
28529
28530
28531
28532
28533
28534
28535
28536
28537
28538
28539
28540
28541
28542
28543
28544
28545
28546
28547
28548
28549
28550
28551
28552
28553
28554
28555
28556
28557
28558
28559
28560
28561
28562
28563
28564
28565
28566
28567
28568
28569
28570
28571
28572
28573
28574
28575
28576
28577
28578
28579
28580
28581
28582
28583
28584
28585
28586
28587
28588
28589
28590
28591
28592
28593
28594
28595
28596
28597
28598
28599
28600
28601
28602
28603
28604
28605
28606
28607
28608
28609
28610
28611
28612
28613
28614
28615
28616
28617
28618
28619
28620
28621
28622
28623
28624
28625
28626
28627
28628
28629
28630
28631
28632
28633
28634
28635
28636
28637
28638
28639
28640
28641
28642
28643
28644
28645
28646
28647
28648
28649
28650
28651
28652
28653
28654
28655
28656
28657
28658
28659
28660
28661
28662
28663
28664
28665
28666
28667
28668
28669
28670
28671
28672
28673
28674
28675
28676
28677
28678
28679
28680
28681
28682
28683
28684
28685
28686
28687
28688
28689
28690
28691
28692
28693
28694
28695
28696
28697
28698
28699
28700
28701
28702
28703
28704
28705
28706
28707
28708
28709
28710
28711
28712
28713
28714
28715
28716
28717
28718
28719
28720
28721
28722
28723
28724
28725
28726
28727
28728
28729
28730
28731
28732
28733
28734
28735
28736
28737
28738
28739
28740
28741
28742
28743
28744
28745
28746
28747
28748
28749
28750
28751
28752
28753
28754
28755
28756
28757
28758
28759
28760
28761
28762
28763
28764
28765
28766
28767
28768
28769
28770
28771
28772
28773
28774
28775
28776
28777
28778
28779
28780
28781
28782
28783
28784
28785
28786
28787
28788
28789
28790
28791
28792
28793
28794
28795
28796
28797
28798
28799
28800
28801
28802
28803
28804
28805
28806
28807
28808
28809
28810
28811
28812
28813
28814
28815
28816
28817
28818
28819
28820
28821
28822
28823
28824
28825
28826
28827
28828
28829
28830
28831
28832
28833
28834
28835
28836
28837
28838
28839
28840
28841
28842
28843
28844
28845
28846
28847
28848
28849
28850
28851
28852
28853
28854
28855
28856
28857
28858
28859
28860
28861
28862
28863
28864
28865
28866
28867
28868
28869
28870
28871
28872
28873
28874
28875
28876
28877
28878
28879
28880
28881
28882
28883
28884
28885
28886
28887
28888
28889
28890
28891
28892
28893
28894
28895
28896
28897
28898
28899
28900
28901
28902
28903
28904
28905
28906
28907
28908
28909
28910
28911
28912
28913
28914
28915
28916
28917
28918
28919
28920
28921
28922
28923
28924
28925
28926
28927
28928
28929
28930
28931
28932
28933
28934
28935
28936
28937
28938
28939
28940
28941
28942
28943
28944
28945
28946
28947
28948
28949
28950
28951
28952
28953
28954
28955
28956
28957
28958
28959
28960
28961
28962
28963
28964
28965
28966
28967
28968
28969
28970
28971
28972
28973
28974
28975
28976
28977
28978
28979
28980
28981
28982
28983
28984
28985
28986
28987
28988
28989
28990
28991
28992
28993
28994
28995
28996
28997
28998
28999
29000
29001
29002
29003
29004
29005
29006
29007
29008
29009
29010
29011
29012
29013
29014
29015
29016
29017
29018
29019
29020
29021
29022
29023
29024
29025
29026
29027
29028
29029
29030
29031
29032
29033
29034
29035
29036
29037
29038
29039
29040
29041
29042
29043
29044
29045
29046
29047
29048
29049
29050
29051
29052
29053
29054
29055
29056
29057
29058
29059
29060
29061
29062
29063
29064
29065
29066
29067
29068
29069
29070
29071
29072
29073
29074
29075
29076
29077
29078
29079
29080
29081
29082
29083
29084
29085
29086
29087
29088
29089
29090
29091
29092
29093
29094
29095
29096
29097
29098
29099
29100
29101
29102
29103
29104
29105
29106
29107
29108
29109
29110
29111
29112
29113
29114
29115
29116
29117
29118
29119
29120
29121
29122
29123
29124
29125
29126
29127
29128
29129
29130
29131
29132
29133
29134
29135
29136
29137
29138
29139
29140
29141
29142
29143
29144
29145
29146
29147
29148
29149
29150
29151
29152
29153
29154
29155
29156
29157
29158
29159
29160
29161
29162
29163
29164
29165
29166
29167
29168
29169
29170
29171
29172
29173
29174
29175
29176
29177
29178
29179
29180
29181
29182
29183
29184
29185
29186
29187
29188
29189
29190
29191
29192
29193
29194
29195
29196
29197
29198
29199
29200
29201
29202
29203
29204
29205
29206
29207
29208
29209
29210
29211
29212
29213
29214
29215
29216
29217
29218
29219
29220
29221
29222
29223
29224
29225
29226
29227
29228
29229
29230
29231
29232
29233
29234
29235
29236
29237
29238
29239
29240
29241
29242
29243
29244
29245
29246
29247
29248
29249
29250
29251
29252
29253
29254
29255
29256
29257
29258
29259
29260
29261
29262
29263
29264
29265
29266
29267
29268
29269
29270
29271
29272
29273
29274
29275
29276
29277
29278
29279
29280
29281
29282
29283
29284
29285
29286
29287
29288
29289
29290
29291
29292
29293
29294
29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
29325
29326
29327
29328
29329
29330
29331
29332
29333
29334
29335
29336
29337
29338
29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
29349
29350
29351
29352
29353
29354
29355
29356
29357
29358
29359
29360
29361
29362
29363
29364
29365
29366
29367
29368
29369
29370
29371
29372
29373
29374
29375
29376
29377
29378
29379
29380
29381
29382
29383
29384
29385
29386
29387
29388
29389
29390
29391
29392
29393
29394
29395
29396
29397
29398
29399
29400
29401
29402
29403
29404
29405
29406
29407
29408
29409
29410
29411
29412
29413
29414
29415
29416
29417
29418
29419
29420
29421
29422
29423
29424
29425
29426
29427
29428
29429
29430
29431
29432
29433
29434
29435
29436
29437
29438
29439
29440
29441
29442
29443
29444
29445
29446
29447
29448
29449
29450
29451
29452
29453
29454
29455
29456
29457
29458
29459
29460
29461
29462
29463
29464
29465
29466
29467
29468
29469
29470
29471
29472
29473
29474
29475
29476
29477
29478
29479
29480
29481
29482
29483
29484
29485
29486
29487
29488
29489
29490
29491
29492
29493
29494
29495
29496
29497
29498
29499
29500
29501
29502
29503
29504
29505
29506
29507
29508
29509
29510
29511
29512
29513
29514
29515
29516
29517
29518
29519
29520
29521
29522
29523
29524
29525
29526
29527
29528
29529
29530
29531
29532
29533
29534
29535
29536
29537
29538
29539
29540
29541
29542
29543
29544
29545
29546
29547
29548
29549
29550
29551
29552
29553
29554
29555
29556
29557
29558
29559
29560
29561
29562
29563
29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
29578
29579
29580
29581
29582
29583
29584
29585
29586
29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
29600
29601
29602
29603
29604
29605
29606
29607
29608
29609
29610
29611
29612
29613
29614
29615
29616
29617
29618
29619
29620
29621
29622
29623
29624
29625
29626
29627
29628
29629
29630
29631
29632
29633
29634
29635
29636
29637
29638
29639
29640
29641
29642
29643
29644
29645
29646
29647
29648
29649
29650
29651
29652
29653
29654
29655
29656
29657
29658
29659
29660
29661
29662
29663
29664
29665
29666
29667
29668
29669
29670
29671
29672
29673
29674
29675
29676
29677
29678
29679
29680
29681
29682
29683
29684
29685
29686
29687
29688
29689
29690
29691
29692
29693
29694
29695
29696
29697
29698
29699
29700
29701
29702
29703
29704
29705
29706
29707
29708
29709
29710
29711
29712
29713
29714
29715
29716
29717
29718
29719
29720
29721
29722
29723
29724
29725
29726
29727
29728
29729
29730
29731
29732
29733
29734
29735
29736
29737
29738
29739
29740
29741
29742
29743
29744
29745
29746
29747
29748
29749
29750
29751
29752
29753
29754
29755
29756
29757
29758
29759
29760
29761
29762
29763
29764
29765
29766
29767
29768
29769
29770
29771
29772
29773
29774
29775
29776
29777
29778
29779
29780
29781
29782
29783
29784
29785
29786
29787
29788
29789
29790
29791
29792
29793
29794
29795
29796
29797
29798
29799
29800
29801
29802
29803
29804
29805
29806
29807
29808
29809
29810
29811
29812
29813
29814
29815
29816
29817
29818
29819
29820
29821
29822
29823
29824
29825
29826
29827
29828
29829
29830
29831
29832
29833
29834
29835
29836
29837
29838
29839
29840
29841
29842
29843
29844
29845
29846
29847
29848
29849
29850
29851
29852
29853
29854
29855
29856
29857
29858
29859
29860
29861
29862
29863
29864
29865
29866
29867
29868
29869
29870
29871
29872
29873
29874
29875
29876
29877
29878
29879
29880
29881
29882
29883
29884
29885
29886
29887
29888
29889
29890
29891
29892
29893
29894
29895
29896
29897
29898
29899
29900
29901
29902
29903
29904
29905
29906
29907
29908
29909
29910
29911
29912
29913
29914
29915
29916
29917
29918
29919
29920
29921
29922
29923
29924
29925
29926
29927
29928
29929
29930
29931
29932
29933
29934
29935
29936
29937
29938
29939
29940
29941
29942
29943
29944
29945
29946
29947
29948
29949
29950
29951
29952
29953
29954
29955
29956
29957
29958
29959
29960
29961
29962
29963
29964
29965
29966
29967
29968
29969
29970
29971
29972
29973
29974
29975
29976
29977
29978
29979
29980
29981
29982
29983
29984
29985
29986
29987
29988
29989
29990
29991
29992
29993
29994
29995
29996
29997
29998
29999
30000
30001
30002
30003
30004
30005
30006
30007
30008
30009
30010
30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
30022
30023
30024
30025
30026
30027
30028
30029
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
30048
30049
30050
30051
30052
30053
30054
30055
30056
30057
30058
30059
30060
30061
30062
30063
30064
30065
30066
30067
30068
30069
30070
30071
30072
30073
30074
30075
30076
30077
30078
30079
30080
30081
30082
30083
30084
30085
30086
30087
30088
30089
30090
30091
30092
30093
30094
30095
30096
30097
30098
30099
30100
30101
30102
30103
30104
30105
30106
30107
30108
30109
30110
30111
30112
30113
30114
30115
30116
30117
30118
30119
30120
30121
30122
30123
30124
30125
30126
30127
30128
30129
30130
30131
30132
30133
30134
30135
30136
30137
30138
30139
30140
30141
30142
30143
30144
30145
30146
30147
30148
30149
30150
30151
30152
30153
30154
30155
30156
30157
30158
30159
30160
30161
30162
30163
30164
30165
30166
30167
30168
30169
30170
30171
30172
30173
30174
30175
30176
30177
30178
30179
30180
30181
30182
30183
30184
30185
30186
30187
30188
30189
30190
30191
30192
30193
30194
30195
30196
30197
30198
30199
30200
30201
30202
30203
30204
30205
30206
30207
30208
30209
30210
30211
30212
30213
30214
30215
30216
30217
30218
30219
30220
30221
30222
30223
30224
30225
30226
30227
30228
30229
30230
30231
30232
30233
30234
30235
30236
30237
30238
30239
30240
30241
30242
30243
30244
30245
30246
30247
30248
30249
30250
30251
30252
30253
30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
30272
30273
30274
30275
30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
30289
30290
30291
30292
30293
30294
30295
30296
30297
30298
30299
30300
30301
30302
30303
30304
30305
30306
30307
30308
30309
30310
30311
30312
30313
30314
30315
30316
30317
30318
30319
30320
30321
30322
30323
30324
30325
30326
30327
30328
30329
30330
30331
30332
30333
30334
30335
30336
30337
30338
30339
30340
30341
30342
30343
30344
30345
30346
30347
30348
30349
30350
30351
30352
30353
30354
30355
30356
30357
30358
30359
30360
30361
30362
30363
30364
30365
30366
30367
30368
30369
30370
30371
30372
30373
30374
30375
30376
30377
30378
30379
30380
30381
30382
30383
30384
30385
30386
30387
30388
30389
30390
30391
30392
30393
30394
30395
30396
30397
30398
30399
30400
30401
30402
30403
30404
30405
30406
30407
30408
30409
30410
30411
30412
30413
30414
30415
30416
30417
30418
30419
30420
30421
30422
30423
30424
30425
30426
30427
30428
30429
30430
30431
30432
30433
30434
30435
30436
30437
30438
30439
30440
30441
30442
30443
30444
30445
30446
30447
30448
30449
30450
30451
30452
30453
30454
30455
30456
30457
30458
30459
30460
30461
30462
30463
30464
30465
30466
30467
30468
30469
30470
30471
30472
30473
30474
30475
30476
30477
30478
30479
30480
30481
30482
30483
30484
30485
30486
30487
30488
30489
30490
30491
30492
30493
30494
30495
30496
30497
30498
30499
30500
30501
30502
30503
30504
30505
30506
30507
30508
30509
30510
30511
30512
30513
30514
30515
30516
30517
30518
30519
30520
30521
30522
30523
30524
30525
30526
30527
30528
30529
30530
30531
30532
30533
30534
30535
30536
30537
30538
30539
30540
30541
30542
30543
30544
30545
30546
30547
30548
30549
30550
30551
30552
30553
30554
30555
30556
30557
30558
30559
30560
30561
30562
30563
30564
30565
30566
30567
30568
30569
30570
30571
30572
30573
30574
30575
30576
30577
30578
30579
30580
30581
30582
30583
30584
30585
30586
30587
30588
30589
30590
30591
30592
30593
30594
30595
30596
30597
30598
30599
30600
30601
30602
30603
30604
30605
30606
30607
30608
30609
30610
30611
30612
30613
30614
30615
30616
30617
30618
30619
30620
30621
30622
30623
30624
30625
30626
30627
30628
30629
30630
30631
30632
30633
30634
30635
30636
30637
30638
30639
30640
30641
30642
30643
30644
30645
30646
30647
30648
30649
30650
30651
30652
30653
30654
30655
30656
30657
30658
30659
30660
30661
30662
30663
30664
30665
30666
30667
30668
30669
30670
30671
30672
30673
30674
30675
30676
30677
30678
30679
30680
30681
30682
30683
30684
30685
30686
30687
30688
30689
30690
30691
30692
30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709
30710
30711
30712
30713
30714
30715
30716
30717
30718
30719
30720
30721
30722
30723
30724
30725
30726
30727
30728
30729
30730
30731
30732
30733
30734
30735
30736
30737
30738
30739
30740
30741
30742
30743
30744
30745
30746
30747
30748
30749
30750
30751
30752
30753
30754
30755
30756
30757
30758
30759
30760
30761
30762
30763
30764
30765
30766
30767
30768
30769
30770
30771
30772
30773
30774
30775
30776
30777
30778
30779
30780
30781
30782
30783
30784
30785
30786
30787
30788
30789
30790
30791
30792
30793
30794
30795
30796
30797
30798
30799
30800
30801
30802
30803
30804
30805
30806
30807
30808
30809
30810
30811
30812
30813
30814
30815
30816
30817
30818
30819
30820
30821
30822
30823
30824
30825
30826
30827
30828
30829
30830
30831
30832
30833
30834
30835
30836
30837
30838
30839
30840
30841
30842
30843
30844
30845
30846
30847
30848
30849
30850
30851
30852
30853
30854
30855
30856
30857
30858
30859
30860
30861
30862
30863
30864
30865
30866
30867
30868
30869
30870
30871
30872
30873
30874
30875
30876
30877
30878
30879
30880
30881
30882
30883
30884
30885
30886
30887
30888
30889
30890
30891
30892
30893
30894
30895
30896
30897
30898
30899
30900
30901
30902
30903
30904
30905
30906
30907
30908
30909
30910
30911
30912
30913
30914
30915
30916
30917
30918
30919
30920
30921
30922
30923
30924
30925
30926
30927
30928
30929
30930
30931
30932
30933
30934
30935
30936
30937
30938
30939
30940
30941
30942
30943
30944
30945
30946
30947
30948
30949
30950
30951
30952
30953
30954
30955
30956
30957
30958
30959
30960
30961
30962
30963
30964
30965
30966
30967
30968
30969
30970
30971
30972
30973
30974
30975
30976
30977
30978
30979
30980
30981
30982
30983
30984
30985
30986
30987
30988
30989
30990
30991
30992
30993
30994
30995
30996
30997
30998
30999
31000
31001
31002
31003
31004
31005
31006
31007
31008
31009
31010
31011
31012
31013
31014
31015
31016
31017
31018
31019
31020
31021
31022
31023
31024
31025
31026
31027
31028
31029
31030
31031
31032
31033
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
31048
31049
31050
31051
31052
31053
31054
31055
31056
31057
31058
31059
31060
31061
31062
31063
31064
31065
31066
31067
31068
31069
31070
31071
31072
31073
31074
31075
31076
31077
31078
31079
31080
31081
31082
31083
31084
31085
31086
31087
31088
31089
31090
31091
31092
31093
31094
31095
31096
31097
31098
31099
31100
31101
31102
31103
31104
31105
31106
31107
31108
31109
31110
31111
31112
31113
31114
31115
31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
31131
31132
31133
31134
31135
31136
31137
31138
31139
31140
31141
31142
31143
31144
31145
31146
31147
31148
31149
31150
31151
31152
31153
31154
31155
31156
31157
31158
31159
31160
31161
31162
31163
31164
31165
31166
31167
31168
31169
31170
31171
31172
31173
31174
31175
31176
31177
31178
31179
31180
31181
31182
31183
31184
31185
31186
31187
31188
31189
31190
31191
31192
31193
31194
31195
31196
31197
31198
31199
31200
31201
31202
31203
31204
31205
31206
31207
31208
31209
31210
31211
31212
31213
31214
31215
31216
31217
31218
31219
31220
31221
31222
31223
31224
31225
31226
31227
31228
31229
31230
31231
31232
31233
31234
31235
31236
31237
31238
31239
31240
31241
31242
31243
31244
31245
31246
31247
31248
31249
31250
31251
31252
31253
31254
31255
31256
31257
31258
31259
31260
31261
31262
31263
31264
31265
31266
31267
31268
31269
31270
31271
31272
31273
31274
31275
31276
31277
31278
31279
31280
31281
31282
31283
31284
31285
31286
31287
31288
31289
31290
31291
31292
31293
31294
31295
31296
31297
31298
31299
31300
31301
31302
31303
31304
31305
31306
31307
31308
31309
31310
31311
31312
31313
31314
31315
31316
31317
31318
31319
31320
31321
31322
31323
31324
31325
31326
31327
31328
31329
31330
31331
31332
31333
31334
31335
31336
31337
31338
31339
31340
31341
31342
31343
31344
31345
31346
31347
31348
31349
31350
31351
31352
31353
31354
31355
31356
31357
31358
31359
31360
31361
31362
31363
31364
31365
31366
31367
31368
31369
31370
31371
31372
31373
31374
31375
31376
31377
31378
31379
31380
31381
31382
31383
31384
31385
31386
31387
31388
31389
31390
31391
31392
31393
31394
31395
31396
31397
31398
31399
31400
31401
31402
31403
31404
31405
31406
31407
31408
31409
31410
31411
31412
31413
31414
31415
31416
31417
31418
31419
31420
31421
31422
31423
31424
31425
31426
31427
31428
31429
31430
31431
31432
31433
31434
31435
31436
31437
31438
31439
31440
31441
31442
31443
31444
31445
31446
31447
31448
31449
31450
31451
31452
31453
31454
31455
31456
31457
31458
31459
31460
31461
31462
31463
31464
31465
31466
31467
31468
31469
31470
31471
31472
31473
31474
31475
31476
31477
31478
31479
31480
31481
31482
31483
31484
31485
31486
31487
31488
31489
31490
31491
31492
31493
31494
31495
31496
31497
31498
31499
31500
31501
31502
31503
31504
31505
31506
31507
31508
31509
31510
31511
31512
31513
31514
31515
31516
31517
31518
31519
31520
31521
31522
31523
31524
31525
31526
31527
31528
31529
31530
31531
31532
31533
31534
31535
31536
31537
31538
31539
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549
31550
31551
31552
31553
31554
31555
31556
31557
31558
31559
31560
31561
31562
31563
31564
31565
31566
31567
31568
31569
31570
31571
31572
31573
31574
31575
31576
31577
31578
31579
31580
31581
31582
31583
31584
31585
31586
31587
31588
31589
31590
31591
31592
31593
31594
31595
31596
31597
31598
31599
31600
31601
31602
31603
31604
31605
31606
31607
31608
31609
31610
31611
31612
31613
31614
31615
31616
31617
31618
31619
31620
31621
31622
31623
31624
31625
31626
31627
31628
31629
31630
31631
31632
31633
31634
31635
31636
31637
31638
31639
31640
31641
31642
31643
31644
31645
31646
31647
31648
31649
31650
31651
31652
31653
31654
31655
31656
31657
31658
31659
31660
31661
31662
31663
31664
31665
31666
31667
31668
31669
31670
31671
31672
31673
31674
31675
31676
31677
31678
31679
31680
31681
31682
31683
31684
31685
31686
31687
31688
31689
31690
31691
31692
31693
31694
31695
31696
31697
31698
31699
31700
31701
31702
31703
31704
31705
31706
31707
31708
31709
31710
31711
31712
31713
31714
31715
31716
31717
31718
31719
31720
31721
31722
31723
31724
31725
31726
31727
31728
31729
31730
31731
31732
31733
31734
31735
31736
31737
31738
31739
31740
31741
31742
31743
31744
31745
31746
31747
31748
31749
31750
31751
31752
31753
31754
31755
31756
31757
31758
31759
31760
31761
31762
31763
31764
31765
31766
31767
31768
31769
31770
31771
31772
31773
31774
31775
31776
31777
31778
31779
31780
31781
31782
31783
31784
31785
31786
31787
31788
31789
31790
31791
31792
31793
31794
31795
31796
31797
31798
31799
31800
31801
31802
31803
31804
31805
31806
31807
31808
31809
31810
31811
31812
31813
31814
31815
31816
31817
31818
31819
31820
31821
31822
31823
31824
31825
31826
31827
31828
31829
31830
31831
31832
31833
31834
31835
31836
31837
31838
31839
31840
31841
31842
31843
31844
31845
31846
31847
31848
31849
31850
31851
31852
31853
31854
31855
31856
31857
31858
31859
31860
31861
31862
31863
31864
31865
31866
31867
31868
31869
31870
31871
31872
31873
31874
31875
31876
31877
31878
31879
31880
31881
31882
31883
31884
31885
31886
31887
31888
31889
31890
31891
31892
31893
31894
31895
31896
31897
31898
31899
31900
31901
31902
31903
31904
31905
31906
31907
31908
31909
31910
31911
31912
31913
31914
31915
31916
31917
31918
31919
31920
31921
31922
31923
31924
31925
31926
31927
31928
31929
31930
31931
31932
31933
31934
31935
31936
31937
31938
31939
31940
31941
31942
31943
31944
31945
31946
31947
31948
31949
31950
31951
31952
31953
31954
31955
31956
31957
31958
31959
31960
31961
31962
31963
31964
31965
31966
31967
31968
31969
31970
31971
31972
31973
31974
31975
31976
31977
31978
31979
31980
31981
31982
31983
31984
31985
31986
31987
31988
31989
31990
31991
31992
31993
31994
31995
31996
31997
31998
31999
32000
32001
32002
32003
32004
32005
32006
32007
32008
32009
32010
32011
32012
32013
32014
32015
32016
32017
32018
32019
32020
32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
32122
32123
32124
32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
32176
32177
32178
32179
32180
32181
32182
32183
32184
32185
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
32206
32207
32208
32209
32210
32211
32212
32213
32214
32215
32216
32217
32218
32219
32220
32221
32222
32223
32224
32225
32226
32227
32228
32229
32230
32231
32232
32233
32234
32235
32236
32237
32238
32239
32240
32241
32242
32243
32244
32245
32246
32247
32248
32249
32250
32251
32252
32253
32254
32255
32256
32257
32258
32259
32260
32261
32262
32263
32264
32265
32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
32276
32277
32278
32279
32280
32281
32282
32283
32284
32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
32297
32298
32299
32300
32301
32302
32303
32304
32305
32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
32339
32340
32341
32342
32343
32344
32345
32346
32347
32348
32349
32350
32351
32352
32353
32354
32355
32356
32357
32358
32359
32360
32361
32362
32363
32364
32365
32366
32367
32368
32369
32370
32371
32372
32373
32374
32375
32376
32377
32378
32379
32380
32381
32382
32383
32384
32385
32386
32387
32388
32389
32390
32391
32392
32393
32394
32395
32396
32397
32398
32399
32400
32401
32402
32403
32404
32405
32406
32407
32408
32409
32410
32411
32412
32413
32414
32415
32416
32417
32418
32419
32420
32421
32422
32423
32424
32425
32426
32427
32428
32429
32430
32431
32432
32433
32434
32435
32436
32437
32438
32439
32440
32441
32442
32443
32444
32445
32446
32447
32448
32449
32450
32451
32452
32453
32454
32455
32456
32457
32458
32459
32460
32461
32462
32463
32464
32465
32466
32467
32468
32469
32470
32471
32472
32473
32474
32475
32476
32477
32478
32479
32480
32481
32482
32483
32484
32485
32486
32487
32488
32489
32490
32491
32492
32493
32494
32495
32496
32497
32498
32499
32500
32501
32502
32503
32504
32505
32506
32507
32508
32509
32510
32511
32512
32513
32514
32515
32516
32517
32518
32519
32520
32521
32522
32523
32524
32525
32526
32527
32528
32529
32530
32531
32532
32533
32534
32535
32536
32537
32538
32539
32540
32541
32542
32543
32544
32545
32546
32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
32567
32568
32569
32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
32621
32622
32623
32624
32625
32626
32627
32628
32629
32630
32631
32632
32633
32634
32635
32636
32637
32638
32639
32640
32641
32642
32643
32644
32645
32646
32647
32648
32649
32650
32651
32652
32653
32654
32655
32656
32657
32658
32659
32660
32661
32662
32663
32664
32665
32666
32667
32668
32669
32670
32671
32672
32673
32674
32675
32676
32677
32678
32679
32680
32681
32682
32683
32684
32685
32686
32687
32688
32689
32690
32691
32692
32693
32694
32695
32696
32697
32698
32699
32700
32701
32702
32703
32704
32705
32706
32707
32708
32709
32710
32711
32712
32713
32714
32715
32716
32717
32718
32719
32720
32721
32722
32723
32724
32725
32726
32727
32728
32729
32730
32731
32732
32733
32734
32735
32736
32737
32738
32739
32740
32741
32742
32743
32744
32745
32746
32747
32748
32749
32750
32751
32752
32753
32754
32755
32756
32757
32758
32759
32760
32761
32762
32763
32764
32765
32766
32767
32768
32769
32770
32771
32772
32773
32774
32775
32776
32777
32778
32779
32780
32781
32782
32783
32784
32785
32786
32787
32788
32789
32790
32791
32792
32793
32794
32795
32796
32797
32798
32799
32800
32801
32802
32803
32804
32805
32806
32807
32808
32809
32810
32811
32812
32813
32814
32815
32816
32817
32818
32819
32820
32821
32822
32823
32824
32825
32826
32827
32828
32829
32830
32831
32832
32833
32834
32835
32836
32837
32838
32839
32840
32841
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851
32852
32853
32854
32855
32856
32857
32858
32859
32860
32861
32862
32863
32864
32865
32866
32867
32868
32869
32870
32871
32872
32873
32874
32875
32876
32877
32878
32879
32880
32881
32882
32883
32884
32885
32886
32887
32888
32889
32890
32891
32892
32893
32894
32895
32896
32897
32898
32899
32900
32901
32902
32903
32904
32905
32906
32907
32908
32909
32910
32911
32912
32913
32914
32915
32916
32917
32918
32919
32920
32921
32922
32923
32924
32925
32926
32927
32928
32929
32930
32931
32932
32933
32934
32935
32936
32937
32938
32939
32940
32941
32942
32943
32944
32945
32946
32947
32948
32949
32950
32951
32952
32953
32954
32955
32956
32957
32958
32959
32960
32961
32962
32963
32964
32965
32966
32967
32968
32969
32970
32971
32972
32973
32974
32975
32976
32977
32978
32979
32980
32981
32982
32983
32984
32985
32986
32987
32988
32989
32990
32991
32992
32993
32994
32995
32996
32997
32998
32999
33000
33001
33002
33003
33004
33005
33006
33007
33008
33009
33010
33011
33012
33013
33014
33015
33016
33017
33018
33019
33020
33021
33022
33023
33024
33025
33026
33027
33028
33029
33030
33031
33032
33033
33034
33035
33036
33037
33038
33039
33040
33041
33042
33043
33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
33076
33077
33078
33079
33080
33081
33082
33083
33084
33085
33086
33087
33088
33089
33090
33091
33092
33093
33094
33095
33096
33097
33098
33099
33100
33101
33102
33103
33104
33105
33106
33107
33108
33109
33110
33111
33112
33113
33114
33115
33116
33117
33118
33119
33120
33121
33122
33123
33124
33125
33126
33127
33128
33129
33130
33131
33132
33133
33134
33135
33136
33137
33138
33139
33140
33141
33142
33143
33144
33145
33146
33147
33148
33149
33150
33151
33152
33153
33154
33155
33156
33157
33158
33159
33160
33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
33171
33172
33173
33174
33175
33176
33177
33178
33179
33180
33181
33182
33183
33184
33185
33186
33187
33188
33189
33190
33191
33192
33193
33194
33195
33196
33197
33198
33199
33200
33201
33202
33203
33204
33205
33206
33207
33208
33209
33210
33211
33212
33213
33214
33215
33216
33217
33218
33219
33220
33221
33222
33223
33224
33225
33226
33227
33228
33229
33230
33231
33232
33233
33234
33235
33236
33237
33238
33239
33240
33241
33242
33243
33244
33245
33246
33247
33248
33249
33250
33251
33252
33253
33254
33255
33256
33257
33258
33259
33260
33261
33262
33263
33264
33265
33266
33267
33268
33269
33270
33271
33272
33273
33274
33275
33276
33277
33278
33279
33280
33281
33282
33283
33284
33285
33286
33287
33288
33289
33290
33291
33292
33293
33294
33295
33296
33297
33298
33299
33300
33301
33302
33303
33304
33305
33306
33307
33308
33309
33310
33311
33312
33313
33314
33315
33316
33317
33318
33319
33320
33321
33322
33323
33324
33325
33326
33327
33328
33329
33330
33331
33332
33333
33334
33335
33336
33337
33338
33339
33340
33341
33342
33343
33344
33345
33346
33347
33348
33349
33350
33351
33352
33353
33354
33355
33356
33357
33358
33359
33360
33361
33362
33363
33364
33365
33366
33367
33368
33369
33370
33371
33372
33373
33374
33375
33376
33377
33378
33379
33380
33381
33382
33383
33384
33385
33386
33387
33388
33389
33390
33391
33392
33393
33394
33395
33396
33397
33398
33399
33400
33401
33402
33403
33404
33405
33406
33407
33408
33409
33410
33411
33412
33413
33414
33415
33416
33417
33418
33419
33420
33421
33422
33423
33424
33425
33426
33427
33428
33429
33430
33431
33432
33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458
33459
33460
33461
33462
33463
33464
33465
33466
33467
33468
33469
33470
33471
33472
33473
33474
33475
33476
33477
33478
33479
33480
33481
33482
33483
33484
33485
33486
33487
33488
33489
33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
33502
33503
33504
33505
33506
33507
33508
33509
33510
33511
33512
33513
33514
33515
33516
33517
33518
33519
33520
33521
33522
33523
33524
33525
33526
33527
33528
33529
33530
33531
33532
33533
33534
33535
33536
33537
33538
33539
33540
33541
33542
33543
33544
33545
33546
33547
33548
33549
33550
33551
33552
33553
33554
33555
33556
33557
33558
33559
33560
33561
33562
33563
33564
33565
33566
33567
33568
33569
33570
33571
33572
33573
33574
33575
33576
33577
33578
33579
33580
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596
33597
33598
33599
33600
33601
33602
33603
33604
33605
33606
33607
33608
33609
33610
33611
33612
33613
33614
33615
33616
33617
33618
33619
33620
33621
33622
33623
33624
33625
33626
33627
33628
33629
33630
33631
33632
33633
33634
33635
33636
33637
33638
33639
33640
33641
33642
33643
33644
33645
33646
33647
33648
33649
33650
33651
33652
33653
33654
33655
33656
33657
33658
33659
33660
33661
33662
33663
33664
33665
33666
33667
33668
33669
33670
33671
33672
33673
33674
33675
33676
33677
33678
33679
33680
33681
33682
33683
33684
33685
33686
33687
33688
33689
33690
33691
33692
33693
33694
33695
33696
33697
33698
33699
33700
33701
33702
33703
33704
33705
33706
33707
33708
33709
33710
33711
33712
33713
33714
33715
33716
33717
33718
33719
33720
33721
33722
33723
33724
33725
33726
33727
33728
33729
33730
33731
33732
33733
33734
33735
33736
33737
33738
33739
33740
33741
33742
33743
33744
33745
33746
33747
33748
33749
33750
33751
33752
33753
33754
33755
33756
33757
33758
33759
33760
33761
33762
33763
33764
33765
33766
33767
33768
33769
33770
33771
33772
33773
33774
33775
33776
33777
33778
33779
33780
33781
33782
33783
33784
33785
33786
33787
33788
33789
33790
33791
33792
33793
33794
33795
33796
33797
33798
33799
33800
33801
33802
33803
33804
33805
33806
33807
33808
33809
33810
33811
33812
33813
33814
33815
33816
33817
33818
33819
33820
33821
33822
33823
33824
33825
33826
33827
33828
33829
33830
33831
33832
33833
33834
33835
33836
33837
33838
33839
33840
33841
33842
33843
33844
33845
33846
33847
33848
33849
33850
33851
33852
33853
33854
33855
33856
33857
33858
33859
33860
33861
33862
33863
33864
33865
33866
33867
33868
33869
33870
33871
33872
33873
33874
33875
33876
33877
33878
33879
33880
33881
33882
33883
33884
33885
33886
33887
33888
33889
33890
33891
33892
33893
33894
33895
33896
33897
33898
33899
33900
33901
33902
33903
33904
33905
33906
33907
33908
33909
33910
33911
33912
33913
33914
33915
33916
33917
33918
33919
33920
33921
33922
33923
33924
33925
33926
33927
33928
33929
33930
33931
33932
33933
33934
33935
33936
33937
33938
33939
33940
33941
33942
33943
33944
33945
33946
33947
33948
33949
33950
33951
33952
33953
33954
33955
33956
33957
33958
33959
33960
33961
33962
33963
33964
33965
33966
33967
33968
33969
33970
33971
33972
33973
33974
33975
33976
33977
33978
33979
33980
33981
33982
33983
33984
33985
33986
33987
33988
33989
33990
33991
33992
33993
33994
33995
33996
33997
33998
33999
34000
34001
34002
34003
34004
34005
34006
34007
34008
34009
34010
34011
34012
34013
34014
34015
34016
34017
34018
34019
34020
34021
34022
34023
34024
34025
34026
34027
34028
34029
34030
34031
34032
34033
34034
34035
34036
34037
34038
34039
34040
34041
34042
34043
34044
34045
34046
34047
34048
34049
34050
34051
34052
34053
34054
34055
34056
34057
34058
34059
34060
34061
34062
34063
34064
34065
34066
34067
34068
34069
34070
34071
34072
34073
34074
34075
34076
34077
34078
34079
34080
34081
34082
34083
34084
34085
34086
34087
34088
34089
34090
34091
34092
34093
34094
34095
34096
34097
34098
34099
34100
34101
34102
34103
34104
34105
34106
34107
34108
34109
34110
34111
34112
34113
34114
34115
34116
34117
34118
34119
34120
34121
34122
34123
34124
34125
34126
34127
34128
34129
34130
34131
34132
34133
34134
34135
34136
34137
34138
34139
34140
34141
34142
34143
34144
34145
34146
34147
34148
34149
34150
34151
34152
34153
34154
34155
34156
34157
34158
34159
34160
34161
34162
34163
34164
34165
34166
34167
34168
34169
34170
34171
34172
34173
34174
34175
34176
34177
34178
34179
34180
34181
34182
34183
34184
34185
34186
34187
34188
34189
34190
34191
34192
34193
34194
34195
34196
34197
34198
34199
34200
34201
34202
34203
34204
34205
34206
34207
34208
34209
34210
34211
34212
34213
34214
34215
34216
34217
34218
34219
34220
34221
34222
34223
34224
34225
34226
34227
34228
34229
34230
34231
34232
34233
34234
34235
34236
34237
34238
34239
34240
34241
34242
34243
34244
34245
34246
34247
34248
34249
34250
34251
34252
34253
34254
34255
34256
34257
34258
34259
34260
34261
34262
34263
34264
34265
34266
34267
34268
34269
34270
34271
34272
34273
34274
34275
34276
34277
34278
34279
34280
34281
34282
34283
34284
34285
34286
34287
34288
34289
34290
34291
34292
34293
34294
34295
34296
34297
34298
34299
34300
34301
34302
34303
34304
34305
34306
34307
34308
34309
34310
34311
34312
34313
34314
34315
34316
34317
34318
34319
34320
34321
34322
34323
34324
34325
34326
34327
34328
34329
34330
34331
34332
34333
34334
34335
34336
34337
34338
34339
34340
34341
34342
34343
34344
34345
34346
34347
34348
34349
34350
34351
34352
34353
34354
34355
34356
34357
34358
34359
34360
34361
34362
34363
34364
34365
34366
34367
34368
34369
34370
34371
34372
34373
34374
34375
34376
34377
34378
34379
34380
34381
34382
34383
34384
34385
34386
34387
34388
34389
34390
34391
34392
34393
34394
34395
34396
34397
34398
34399
34400
34401
34402
34403
34404
34405
34406
34407
34408
34409
34410
34411
34412
34413
34414
34415
34416
34417
34418
34419
34420
34421
34422
34423
34424
34425
34426
34427
34428
34429
34430
34431
34432
34433
34434
34435
34436
34437
34438
34439
34440
34441
34442
34443
34444
34445
34446
34447
34448
34449
34450
34451
34452
34453
34454
34455
34456
34457
34458
34459
34460
34461
34462
34463
34464
34465
34466
34467
34468
34469
34470
34471
34472
34473
34474
34475
34476
34477
34478
34479
34480
34481
34482
34483
34484
34485
34486
34487
34488
34489
34490
34491
34492
34493
34494
34495
34496
34497
34498
34499
34500
34501
34502
34503
34504
34505
34506
34507
34508
34509
34510
34511
34512
34513
34514
34515
34516
34517
34518
34519
34520
34521
34522
34523
34524
34525
34526
34527
34528
34529
34530
34531
34532
34533
34534
34535
34536
34537
34538
34539
34540
34541
34542
34543
34544
34545
34546
34547
34548
34549
34550
34551
34552
34553
34554
34555
34556
34557
34558
34559
34560
34561
34562
34563
34564
34565
34566
34567
34568
34569
34570
34571
34572
34573
34574
34575
34576
34577
34578
34579
34580
34581
34582
34583
34584
34585
34586
34587
34588
34589
34590
34591
34592
34593
34594
34595
34596
34597
34598
34599
34600
34601
34602
34603
34604
34605
34606
34607
34608
34609
34610
34611
34612
34613
34614
34615
34616
34617
34618
34619
34620
34621
34622
34623
34624
34625
34626
34627
34628
34629
34630
34631
34632
34633
34634
34635
34636
34637
34638
34639
34640
34641
34642
34643
34644
34645
34646
34647
34648
34649
34650
34651
34652
34653
34654
34655
34656
34657
34658
34659
34660
34661
34662
34663
34664
34665
34666
34667
34668
34669
34670
34671
34672
34673
34674
34675
34676
34677
34678
34679
34680
34681
34682
34683
34684
34685
34686
34687
34688
34689
34690
34691
34692
34693
34694
34695
34696
34697
34698
34699
34700
34701
34702
34703
34704
34705
34706
34707
34708
34709
34710
34711
34712
34713
34714
34715
34716
34717
34718
34719
34720
34721
34722
34723
34724
34725
34726
34727
34728
34729
34730
34731
34732
34733
34734
34735
34736
34737
34738
34739
34740
34741
34742
34743
34744
34745
34746
34747
34748
34749
34750
34751
34752
34753
34754
34755
34756
34757
34758
34759
34760
34761
34762
34763
34764
34765
34766
34767
34768
34769
34770
34771
34772
34773
34774
34775
34776
34777
34778
34779
34780
34781
34782
34783
34784
34785
34786
34787
34788
34789
34790
34791
34792
34793
34794
34795
34796
34797
34798
34799
34800
34801
34802
34803
34804
34805
34806
34807
34808
34809
34810
34811
34812
34813
34814
34815
34816
34817
34818
34819
34820
34821
34822
34823
34824
34825
34826
34827
34828
34829
34830
34831
34832
34833
34834
34835
34836
34837
34838
34839
34840
34841
34842
34843
34844
34845
34846
34847
34848
34849
34850
34851
34852
34853
34854
34855
34856
34857
34858
34859
34860
34861
34862
34863
34864
34865
34866
34867
34868
34869
34870
34871
34872
34873
34874
34875
34876
34877
34878
34879
34880
34881
34882
34883
34884
34885
34886
34887
34888
34889
34890
34891
34892
34893
34894
34895
34896
34897
34898
34899
34900
34901
34902
34903
34904
34905
34906
34907
34908
34909
34910
34911
34912
34913
34914
34915
34916
34917
34918
34919
34920
34921
34922
34923
34924
34925
34926
34927
34928
34929
34930
34931
34932
34933
34934
34935
34936
34937
34938
34939
34940
34941
34942
34943
34944
34945
34946
34947
34948
34949
34950
34951
34952
34953
34954
34955
34956
34957
34958
34959
34960
34961
34962
34963
34964
34965
34966
34967
34968
34969
34970
34971
34972
34973
34974
34975
34976
34977
34978
34979
34980
34981
34982
34983
34984
34985
34986
34987
34988
34989
34990
34991
34992
34993
34994
34995
34996
34997
34998
34999
35000
35001
35002
35003
35004
35005
35006
35007
35008
35009
35010
35011
35012
35013
35014
35015
35016
35017
35018
35019
35020
35021
35022
35023
35024
35025
35026
35027
35028
35029
35030
35031
35032
35033
35034
35035
35036
35037
35038
35039
35040
35041
35042
35043
35044
35045
35046
35047
35048
35049
35050
35051
35052
35053
35054
35055
35056
35057
35058
35059
35060
35061
35062
35063
35064
35065
35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076
35077
35078
35079
35080
35081
35082
35083
35084
35085
35086
35087
35088
35089
35090
35091
35092
35093
35094
35095
35096
35097
35098
35099
35100
35101
35102
35103
35104
35105
35106
35107
35108
35109
35110
35111
35112
35113
35114
35115
35116
35117
35118
35119
35120
35121
35122
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153
35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
35172
35173
35174
35175
35176
35177
35178
35179
35180
35181
35182
35183
35184
35185
35186
35187
35188
35189
35190
35191
35192
35193
35194
35195
35196
35197
35198
35199
35200
35201
35202
35203
35204
35205
35206
35207
35208
35209
35210
35211
35212
35213
35214
35215
35216
35217
35218
35219
35220
35221
35222
35223
35224
35225
35226
35227
35228
35229
35230
35231
35232
35233
35234
35235
35236
35237
35238
35239
35240
35241
35242
35243
35244
35245
35246
35247
35248
35249
35250
35251
35252
35253
35254
35255
35256
35257
35258
35259
35260
35261
35262
35263
35264
35265
35266
35267
35268
35269
35270
35271
35272
35273
35274
35275
35276
35277
35278
35279
35280
35281
35282
35283
35284
35285
35286
35287
35288
35289
35290
35291
35292
35293
35294
35295
35296
35297
35298
35299
35300
35301
35302
35303
35304
35305
35306
35307
35308
35309
35310
35311
35312
35313
35314
35315
35316
35317
35318
35319
35320
35321
35322
35323
35324
35325
35326
35327
35328
35329
35330
35331
35332
35333
35334
35335
35336
35337
35338
35339
35340
35341
35342
35343
35344
35345
35346
35347
35348
35349
35350
35351
35352
35353
35354
35355
35356
35357
35358
35359
35360
35361
35362
35363
35364
35365
35366
35367
35368
35369
35370
35371
35372
35373
35374
35375
35376
35377
35378
35379
35380
35381
35382
35383
35384
35385
35386
35387
35388
35389
35390
35391
35392
35393
35394
35395
35396
35397
35398
35399
35400
35401
35402
35403
35404
35405
35406
35407
35408
35409
35410
35411
35412
35413
35414
35415
35416
35417
35418
35419
35420
35421
35422
35423
35424
35425
35426
35427
35428
35429
35430
35431
35432
35433
35434
35435
35436
35437
35438
35439
35440
35441
35442
35443
35444
35445
35446
35447
35448
35449
35450
35451
35452
35453
35454
35455
35456
35457
35458
35459
35460
35461
35462
35463
35464
35465
35466
35467
35468
35469
35470
35471
35472
35473
35474
35475
35476
35477
35478
35479
35480
35481
35482
35483
35484
35485
35486
35487
35488
35489
35490
35491
35492
35493
35494
35495
35496
35497
35498
35499
35500
35501
35502
35503
35504
35505
35506
35507
35508
35509
35510
35511
35512
35513
35514
35515
35516
35517
35518
35519
35520
35521
35522
35523
35524
35525
35526
35527
35528
35529
35530
35531
35532
35533
35534
35535
35536
35537
35538
35539
35540
35541
35542
35543
35544
35545
35546
35547
35548
35549
35550
35551
35552
35553
35554
35555
35556
35557
35558
35559
35560
35561
35562
35563
35564
35565
35566
35567
35568
35569
35570
35571
35572
35573
35574
35575
35576
35577
35578
35579
35580
35581
35582
35583
35584
35585
35586
35587
35588
35589
35590
35591
35592
35593
35594
35595
35596
35597
35598
35599
35600
35601
35602
35603
35604
35605
35606
35607
35608
35609
35610
35611
35612
35613
35614
35615
35616
35617
35618
35619
35620
35621
35622
35623
35624
35625
35626
35627
35628
35629
35630
35631
35632
35633
35634
35635
35636
35637
35638
35639
35640
35641
35642
35643
35644
35645
35646
35647
35648
35649
35650
35651
35652
35653
35654
35655
35656
35657
35658
35659
35660
35661
35662
35663
35664
35665
35666
35667
35668
35669
35670
35671
35672
35673
35674
35675
35676
35677
35678
35679
35680
35681
35682
35683
35684
35685
35686
35687
35688
35689
35690
35691
35692
35693
35694
35695
35696
35697
35698
35699
35700
35701
35702
35703
35704
35705
35706
35707
35708
35709
35710
35711
35712
35713
35714
35715
35716
35717
35718
35719
35720
35721
35722
35723
35724
35725
35726
35727
35728
35729
35730
35731
35732
35733
35734
35735
35736
35737
35738
35739
35740
35741
35742
35743
35744
35745
35746
35747
35748
35749
35750
35751
35752
35753
35754
35755
35756
35757
35758
35759
35760
35761
35762
35763
35764
35765
35766
35767
35768
35769
35770
35771
35772
35773
35774
35775
35776
35777
35778
35779
35780
35781
35782
35783
35784
35785
35786
35787
35788
35789
35790
35791
35792
35793
35794
35795
35796
35797
35798
35799
35800
35801
35802
35803
35804
35805
35806
35807
35808
35809
35810
35811
35812
35813
35814
35815
35816
35817
35818
35819
35820
35821
35822
35823
35824
35825
35826
35827
35828
35829
35830
35831
35832
35833
35834
35835
35836
35837
35838
35839
35840
35841
35842
35843
35844
35845
35846
35847
35848
35849
35850
35851
35852
35853
35854
35855
35856
35857
35858
35859
35860
35861
35862
35863
35864
35865
35866
35867
35868
35869
35870
--[[info-----------------------------------------------------------------------
  Luaotfload fontloader package
  build 2022-02-24 08:04:22
-------------------------------------------------------------------------------

  © 2022 PRAGMA ADE / ConTeXt Development Team

  The code in this file is provided under the GPL v2.0 license. See the
  file COPYING in the Luaotfload repository for details.

  Report bugs to https://github.com/latex3/luaotfload

  This file has been assembled from components taken from Context. See
  the Luaotfload documentation for details:

      $ texdoc luaotfload
      $ man 1 luaotfload-tool
      $ man 5 luaotfload.conf

  Included files:

    · fontloader-data-con.lua
    · fontloader-basics-nod.lua
    · fontloader-basics-chr.lua
    · fontloader-font-ini.lua
    · fontloader-fonts-mis.lua
    · fontloader-font-con.lua
    · fontloader-fonts-enc.lua
    · fontloader-font-cid.lua
    · fontloader-font-map.lua
    · fontloader-font-vfc.lua
    · fontloader-font-otr.lua
    · fontloader-font-oti.lua
    · fontloader-font-ott.lua
    · fontloader-font-cff.lua
    · fontloader-font-ttf.lua
    · fontloader-font-dsp.lua
    · fontloader-font-oup.lua
    · fontloader-font-otl.lua
    · fontloader-font-oto.lua
    · fontloader-font-otj.lua
    · fontloader-font-ota.lua
    · fontloader-font-ots.lua
    · fontloader-font-osd.lua
    · fontloader-font-ocl.lua
    · fontloader-font-otc.lua
    · fontloader-font-onr.lua
    · fontloader-font-one.lua
    · fontloader-font-afk.lua
    · fontloader-fonts-tfm.lua
    · fontloader-font-lua.lua
    · fontloader-font-def.lua
    · fontloader-font-shp.lua
    · fontloader-fonts-def.lua
    · fontloader-fonts-ext.lua
    · fontloader-font-imp-tex.lua
    · fontloader-font-imp-ligatures.lua
    · fontloader-font-imp-italics.lua
    · fontloader-font-imp-effects.lua
    · fontloader-fonts-lig.lua
    · fontloader-fonts-gbn.lua

--info]]-----------------------------------------------------------------------


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “data-con” 23a0f5386d46a1c157ae82a373e35fa0] ---

if not modules then modules={} end modules ['data-con']={
 version=1.100,
 comment="companion to luat-lib.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local setmetatable=setmetatable
local format,lower,gsub=string.format,string.lower,string.gsub
local trace_cache=false  trackers.register("resolvers.cache",function(v) trace_cache=v end)
local trace_containers=false  trackers.register("resolvers.containers",function(v) trace_containers=v end)
local trace_storage=false  trackers.register("resolvers.storage",function(v) trace_storage=v end)
containers=containers or {}
local containers=containers
containers.usecache=true
local getwritablepath=caches.getwritablepath
local getreadablepaths=caches.getreadablepaths
local cacheiswritable=caches.is_writable
local loaddatafromcache=caches.loaddata
local savedataincache=caches.savedata
local report_containers=logs.reporter("resolvers","containers")
local allocated={}
local mt={
 __index=function(t,k)
  if k=="writable" then
   local writable=getwritablepath(t.category,t.subcategory) or { "." }
   t.writable=writable
   return writable
  elseif k=="readables" then
   local readables=getreadablepaths(t.category,t.subcategory) or { "." }
   t.readables=readables
   return readables
  end
 end,
 __storage__=true
}
function containers.define(category,subcategory,version,enabled)
 if category and subcategory then
  local c=allocated[category]
  if not c then
   c={}
   allocated[category]=c
  end
  local s=c[subcategory]
  if not s then
   s={
    category=category,
    subcategory=subcategory,
    storage={},
    enabled=enabled,
    version=version or math.pi,
    trace=false,
   }
   setmetatable(s,mt)
   c[subcategory]=s
  end
  return s
 end
end
function containers.is_usable(container,name)
 return container.enabled and caches and cacheiswritable(container.writable,name)
end
function containers.is_valid(container,name)
 if name and name~="" then
  local storage=container.storage[name]
  return storage and storage.cache_version==container.version
 else
  return false
 end
end
function containers.read(container,name)
 local storage=container.storage
 local stored=storage[name]
 if not stored and container.enabled and caches and containers.usecache then
  stored=loaddatafromcache(container.readables,name,container.writable)
  if stored and stored.cache_version==container.version then
   if trace_cache or trace_containers then
    report_containers("action %a, category %a, name %a","load",container.subcategory,name)
   end
  else
   stored=nil
  end
  storage[name]=stored
 elseif stored then
  if trace_cache or trace_containers then
   report_containers("action %a, category %a, name %a","reuse",container.subcategory,name)
  end
 end
 return stored
end
function containers.write(container,name,data,fast)
 if data then
  data.cache_version=container.version
  if container.enabled and caches then
   local unique=data.unique
   local shared=data.shared
   data.unique=nil
   data.shared=nil
   savedataincache(container.writable,name,data,fast)
   if trace_cache or trace_containers then
    report_containers("action %a, category %a, name %a","save",container.subcategory,name)
   end
   data.unique=unique
   data.shared=shared
  end
  if trace_cache or trace_containers then
   report_containers("action %a, category %a, name %a","store",container.subcategory,name)
  end
  container.storage[name]=data
 end
 return data
end
function containers.content(container,name)
 return container.storage[name]
end
function containers.cleanname(name)
 return (gsub(lower(name),"[^%w\128-\255]+","-")) 
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “data-con”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “basics-nod” 1750af43148def9e7a75c6900a96f9dc] ---

if not modules then modules={} end modules ['luatex-fonts-nod']={
 version=1.001,
 comment="companion to luatex-fonts.lua",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
if tex.attribute[0]~=0 then
 texio.write_nl("log","!")
 texio.write_nl("log","! Attribute 0 is reserved for ConTeXt's font feature management and has to be")
 texio.write_nl("log","! set to zero. Also, some attributes in the range 1-255 are used for special")
 texio.write_nl("log","! purposes so setting them at the TeX end might break the font handler.")
 texio.write_nl("log","!")
 tex.attribute[0]=0 
end
attributes=attributes or {}
attributes.unsetvalue=-0x7FFFFFFF
local numbers,last={},127
attributes.private=attributes.private or function(name)
 local number=numbers[name]
 if not number then
  if last<255 then
   last=last+1
  end
  number=last
  numbers[name]=number
 end
 return number
end
nodes={}
nodes.handlers={}
local nodecodes={}
local glyphcodes=node.subtypes("glyph")
local disccodes=node.subtypes("disc")
for k,v in next,node.types() do
 v=string.gsub(v,"_","")
 nodecodes[k]=v
 nodecodes[v]=k
end
for k,v in next,glyphcodes do
 glyphcodes[v]=k
end
for k,v in next,disccodes do
 disccodes[v]=k
end
nodes.nodecodes=nodecodes
nodes.glyphcodes=glyphcodes
nodes.disccodes=disccodes
nodes.dirvalues={ lefttoright=0,righttoleft=1 }
nodes.handlers.protectglyphs=node.protectglyphs   or node.protect_glyphs   
nodes.handlers.unprotectglyphs=node.unprotectglyphs or node.unprotect_glyphs
local direct=node.direct
local nuts={}
nodes.nuts=nuts
local tonode=direct.tonode
local tonut=direct.todirect
nodes.tonode=tonode
nodes.tonut=tonut
nuts.tonode=tonode
nuts.tonut=tonut
nuts.getattr=direct.get_attribute
nuts.getboth=direct.getboth
nuts.getchar=direct.getchar
nuts.getdirection=direct.getdirection
nuts.getdisc=direct.getdisc
nuts.getreplace=direct.getreplace
nuts.getfield=direct.getfield
nuts.getfont=direct.getfont
nuts.getid=direct.getid
nuts.getkern=direct.getkern
nuts.getlist=direct.getlist
nuts.getnext=direct.getnext
nuts.getoffsets=direct.getoffsets
nuts.getoptions=direct.getoptions or function() return 0 end
nuts.getprev=direct.getprev
nuts.getsubtype=direct.getsubtype
nuts.getwidth=direct.getwidth
nuts.setattr=direct.setfield
nuts.setboth=direct.setboth
nuts.setchar=direct.setchar
nuts.setcomponents=direct.setcomponents
nuts.setdirection=direct.setdirection
nuts.setdisc=direct.setdisc
nuts.setreplace=direct.setreplace
nuts.setfield=direct.setfield
nuts.setkern=direct.setkern
nuts.setlink=direct.setlink
nuts.setlist=direct.setlist
nuts.setnext=direct.setnext
nuts.setoffsets=direct.setoffsets
nuts.setprev=direct.setprev
nuts.setsplit=direct.setsplit
nuts.setsubtype=direct.setsubtype
nuts.setwidth=direct.setwidth
nuts.getglyphdata=nuts.getattribute or nuts.getattr
nuts.setglyphdata=nuts.setattribute or nuts.setattr
nuts.ischar=direct.ischar  or direct.is_char
nuts.isglyph=direct.isglyph    or direct.is_glyph
nuts.copy=direct.copy
nuts.copynode=direct.copy
nuts.copylist=direct.copylist   or direct.copy_list
nuts.endofmath=direct.endofmath  or direct.end_of_math
nuts.flush=direct.flush
nuts.flushlist=direct.flushlist  or direct.flush_list
nuts.flushnode=direct.flushnode  or direct.flush_node
nuts.free=direct.free
nuts.insertafter=direct.insertafter   or direct.insert_after
nuts.insertbefore=direct.insertbefore  or direct.insert_before
nuts.isnode=direct.isnode  or direct.is_node
nuts.isdirect=direct.isdirect   or direct.is_direct
nuts.isnut=direct.isdirect   or direct.is_direct
nuts.kerning=direct.kerning
nuts.ligaturing=direct.ligaturing
nuts.new=direct.new
nuts.remove=direct.remove
nuts.tail=direct.tail
nuts.traverse=direct.traverse
nuts.traversechar=direct.traversechar  or direct.traverse_char
nuts.traverseglyph=direct.traverseglyph or direct.traverse_glyph
nuts.traverseid=direct.traverseid or direct.traverse_id
local propertydata=(direct.getpropertiestable or direct.get_properties_table)()
nodes.properties={ data=propertydata }
if direct.set_properties_mode then
 direct.set_properties_mode(true,true)
 function direct.set_properties_mode() end
end
nuts.getprop=function(n,k)
 local p=propertydata[n]
 if p then
  return p[k]
 end
end
nuts.setprop=function(n,k,v)
 if v then
  local p=propertydata[n]
  if p then
   p[k]=v
  else
   propertydata[n]={ [k]=v }
  end
 end
end
nodes.setprop=nodes.setproperty
nodes.getprop=nodes.getproperty
local setprev=nuts.setprev
local setnext=nuts.setnext
local getnext=nuts.getnext
local setlink=nuts.setlink
local getfield=nuts.getfield
local setfield=nuts.setfield
local getsubtype=nuts.getsubtype
local isglyph=nuts.isglyph
local find_tail=nuts.tail
local flushlist=nuts.flushlist
local flushnode=nuts.flushnode
local traverseid=nuts.traverseid
local copynode=nuts.copynode
local glyph_code=nodes.nodecodes.glyph
local ligature_code=nodes.glyphcodes.ligature
do 
 local p=nodecodes.localpar or nodecodes.local_par
 if p then
  nodecodes.par=p
  nodecodes[p]="par"
  nodecodes.localpar=p 
  nodecodes.local_par=p 
 end
end
do
 local getcomponents=node.direct.getcomponents
 local setcomponents=node.direct.setcomponents
 local function copynocomponents(g,copyinjection)
  local components=getcomponents(g)
  if components then
   setcomponents(g)
   local n=copynode(g)
   if copyinjection then
    copyinjection(n,g)
   end
   setcomponents(g,components)
   return n
  else
   local n=copynode(g)
   if copyinjection then
    copyinjection(n,g)
   end
   return n
  end
 end
 local function copyonlyglyphs(current)
  local head=nil
  local previous=nil
  for n in traverseid(glyph_code,current) do
   n=copynode(n)
   if head then
    setlink(previous,n)
   else
    head=n
   end
   previous=n
  end
  return head
 end
 local function countcomponents(start,marks)
  local char=isglyph(start)
  if char then
   if getsubtype(start)==ligature_code then
    local n=0
    local components=getcomponents(start)
    while components do
     n=n+countcomponents(components,marks)
     components=getnext(components)
    end
    return n
   elseif not marks[char] then
    return 1
   end
  end
  return 0
 end
 local function flushcomponents()
 end
 nuts.components={
  set=setcomponents,
  get=getcomponents,
  copyonlyglyphs=copyonlyglyphs,
  copynocomponents=copynocomponents,
  count=countcomponents,
  flush=flushcomponents,
 }
end
nuts.usesfont=direct.usesfont or direct.uses_font
do
 local dummy=tonut(node.new("glyph"))
 nuts.traversers={
  glyph=nuts.traverseid(nodecodes.glyph,dummy),
  glue=nuts.traverseid(nodecodes.glue,dummy),
  disc=nuts.traverseid(nodecodes.disc,dummy),
  boundary=nuts.traverseid(nodecodes.boundary,dummy),
  char=nuts.traversechar(dummy),
  node=nuts.traverse(dummy),
 }
end
if not nuts.setreplace then
 local getdisc=nuts.getdisc
 local setfield=nuts.setfield
 function nuts.getreplace(n)
  local _,_,h,_,_,t=getdisc(n,true)
  return h,t
 end
 function nuts.setreplace(n,h)
  setfield(n,"replace",h)
 end
end
do
 local getsubtype=nuts.getsubtype
 function nuts.startofpar(n)
  local s=getsubtype(n)
  return s==0 or s==2 
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “basics-nod”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “basics-chr” 1bb1ea05b5ca1bb5a9848b9eb66322bf] ---


characters=characters or {}
characters.blockrange={}
characters.classifiers={
 [768]=5,
 [769]=5,
 [770]=5,
 [771]=5,
 [772]=5,
 [773]=5,
 [774]=5,
 [775]=5,
 [776]=5,
 [777]=5,
 [778]=5,
 [779]=5,
 [780]=5,
 [781]=5,
 [782]=5,
 [783]=5,
 [784]=5,
 [785]=5,
 [786]=5,
 [787]=5,
 [788]=5,
 [789]=5,
 [790]=5,
 [791]=5,
 [792]=5,
 [793]=5,
 [794]=5,
 [795]=5,
 [796]=5,
 [797]=5,
 [798]=5,
 [799]=5,
 [800]=5,
 [801]=5,
 [802]=5,
 [803]=5,
 [804]=5,
 [805]=5,
 [806]=5,
 [807]=5,
 [808]=5,
 [809]=5,
 [810]=5,
 [811]=5,
 [812]=5,
 [813]=5,
 [814]=5,
 [815]=5,
 [816]=5,
 [817]=5,
 [818]=5,
 [819]=5,
 [820]=5,
 [821]=5,
 [822]=5,
 [823]=5,
 [824]=5,
 [825]=5,
 [826]=5,
 [827]=5,
 [828]=5,
 [829]=5,
 [830]=5,
 [831]=5,
 [832]=5,
 [833]=5,
 [834]=5,
 [835]=5,
 [836]=5,
 [837]=5,
 [838]=5,
 [839]=5,
 [840]=5,
 [841]=5,
 [842]=5,
 [843]=5,
 [844]=5,
 [845]=5,
 [846]=5,
 [847]=5,
 [848]=5,
 [849]=5,
 [850]=5,
 [851]=5,
 [852]=5,
 [853]=5,
 [854]=5,
 [855]=5,
 [856]=5,
 [857]=5,
 [858]=5,
 [859]=5,
 [860]=5,
 [861]=5,
 [862]=5,
 [863]=5,
 [864]=5,
 [865]=5,
 [866]=5,
 [867]=5,
 [868]=5,
 [869]=5,
 [870]=5,
 [871]=5,
 [872]=5,
 [873]=5,
 [874]=5,
 [875]=5,
 [876]=5,
 [877]=5,
 [878]=5,
 [879]=5,
 [1155]=5,
 [1156]=5,
 [1157]=5,
 [1158]=5,
 [1159]=5,
 [1425]=5,
 [1426]=5,
 [1427]=5,
 [1428]=5,
 [1429]=5,
 [1430]=5,
 [1431]=5,
 [1432]=5,
 [1433]=5,
 [1434]=5,
 [1435]=5,
 [1436]=5,
 [1437]=5,
 [1438]=5,
 [1439]=5,
 [1440]=5,
 [1441]=5,
 [1442]=5,
 [1443]=5,
 [1444]=5,
 [1445]=5,
 [1446]=5,
 [1447]=5,
 [1448]=5,
 [1449]=5,
 [1450]=5,
 [1451]=5,
 [1452]=5,
 [1453]=5,
 [1454]=5,
 [1455]=5,
 [1456]=5,
 [1457]=5,
 [1458]=5,
 [1459]=5,
 [1460]=5,
 [1461]=5,
 [1462]=5,
 [1463]=5,
 [1464]=5,
 [1465]=5,
 [1466]=5,
 [1467]=5,
 [1468]=5,
 [1469]=5,
 [1471]=5,
 [1473]=5,
 [1474]=5,
 [1476]=5,
 [1477]=5,
 [1479]=5,
 [1536]=4,
 [1537]=4,
 [1538]=4,
 [1539]=4,
 [1540]=4,
 [1541]=4,
 [1542]=6,
 [1543]=6,
 [1544]=4,
 [1545]=6,
 [1546]=6,
 [1547]=4,
 [1548]=6,
 [1549]=6,
 [1550]=6,
 [1551]=6,
 [1552]=5,
 [1553]=5,
 [1554]=5,
 [1555]=5,
 [1556]=5,
 [1557]=5,
 [1558]=5,
 [1559]=5,
 [1560]=5,
 [1561]=5,
 [1562]=5,
 [1563]=6,
 [1564]=6,
 [1565]=6,
 [1566]=6,
 [1567]=6,
 [1568]=2,
 [1569]=4,
 [1570]=3,
 [1571]=3,
 [1572]=3,
 [1573]=3,
 [1574]=2,
 [1575]=3,
 [1576]=2,
 [1577]=3,
 [1578]=2,
 [1579]=2,
 [1580]=2,
 [1581]=2,
 [1582]=2,
 [1583]=3,
 [1584]=3,
 [1585]=3,
 [1586]=3,
 [1587]=2,
 [1588]=2,
 [1589]=2,
 [1590]=2,
 [1591]=2,
 [1592]=2,
 [1593]=2,
 [1594]=2,
 [1595]=2,
 [1596]=2,
 [1597]=2,
 [1598]=2,
 [1599]=2,
 [1600]=2,
 [1601]=2,
 [1602]=2,
 [1603]=2,
 [1604]=2,
 [1605]=2,
 [1606]=2,
 [1607]=2,
 [1608]=3,
 [1609]=2,
 [1610]=2,
 [1611]=5,
 [1612]=5,
 [1613]=5,
 [1614]=5,
 [1615]=5,
 [1616]=5,
 [1617]=5,
 [1618]=5,
 [1619]=5,
 [1620]=5,
 [1621]=5,
 [1622]=5,
 [1623]=5,
 [1624]=5,
 [1625]=5,
 [1626]=5,
 [1627]=5,
 [1628]=5,
 [1629]=5,
 [1630]=5,
 [1631]=5,
 [1632]=6,
 [1633]=6,
 [1634]=6,
 [1635]=6,
 [1636]=6,
 [1637]=6,
 [1638]=6,
 [1639]=6,
 [1640]=6,
 [1641]=6,
 [1642]=6,
 [1643]=6,
 [1644]=6,
 [1645]=6,
 [1646]=2,
 [1647]=2,
 [1648]=5,
 [1649]=3,
 [1650]=3,
 [1651]=3,
 [1652]=4,
 [1653]=3,
 [1654]=3,
 [1655]=3,
 [1656]=2,
 [1657]=2,
 [1658]=2,
 [1659]=2,
 [1660]=2,
 [1661]=2,
 [1662]=2,
 [1663]=2,
 [1664]=2,
 [1665]=2,
 [1666]=2,
 [1667]=2,
 [1668]=2,
 [1669]=2,
 [1670]=2,
 [1671]=2,
 [1672]=3,
 [1673]=3,
 [1674]=3,
 [1675]=3,
 [1676]=3,
 [1677]=3,
 [1678]=3,
 [1679]=3,
 [1680]=3,
 [1681]=3,
 [1682]=3,
 [1683]=3,
 [1684]=3,
 [1685]=3,
 [1686]=3,
 [1687]=3,
 [1688]=3,
 [1689]=3,
 [1690]=2,
 [1691]=2,
 [1692]=2,
 [1693]=2,
 [1694]=2,
 [1695]=2,
 [1696]=2,
 [1697]=2,
 [1698]=2,
 [1699]=2,
 [1700]=2,
 [1701]=2,
 [1702]=2,
 [1703]=2,
 [1704]=2,
 [1705]=2,
 [1706]=2,
 [1707]=2,
 [1708]=2,
 [1709]=2,
 [1710]=2,
 [1711]=2,
 [1712]=2,
 [1713]=2,
 [1714]=2,
 [1715]=2,
 [1716]=2,
 [1717]=2,
 [1718]=2,
 [1719]=2,
 [1720]=2,
 [1721]=2,
 [1722]=2,
 [1723]=2,
 [1724]=2,
 [1725]=2,
 [1726]=2,
 [1727]=2,
 [1728]=3,
 [1729]=2,
 [1730]=2,
 [1731]=3,
 [1732]=3,
 [1733]=3,
 [1734]=3,
 [1735]=3,
 [1736]=3,
 [1737]=3,
 [1738]=3,
 [1739]=3,
 [1740]=2,
 [1741]=3,
 [1742]=2,
 [1743]=3,
 [1744]=2,
 [1745]=2,
 [1746]=3,
 [1747]=3,
 [1748]=6,
 [1749]=3,
 [1750]=5,
 [1751]=5,
 [1752]=5,
 [1753]=5,
 [1754]=5,
 [1755]=5,
 [1756]=5,
 [1757]=4,
 [1758]=6,
 [1759]=5,
 [1760]=5,
 [1761]=5,
 [1762]=5,
 [1763]=5,
 [1764]=5,
 [1765]=6,
 [1766]=6,
 [1767]=5,
 [1768]=5,
 [1769]=6,
 [1770]=5,
 [1771]=5,
 [1772]=5,
 [1773]=5,
 [1774]=3,
 [1775]=3,
 [1776]=6,
 [1777]=6,
 [1778]=6,
 [1779]=6,
 [1780]=6,
 [1781]=6,
 [1782]=6,
 [1783]=6,
 [1784]=6,
 [1785]=6,
 [1786]=2,
 [1787]=2,
 [1788]=2,
 [1789]=6,
 [1790]=6,
 [1791]=2,
 [1792]=6,
 [1793]=6,
 [1794]=6,
 [1795]=6,
 [1796]=6,
 [1797]=6,
 [1798]=6,
 [1799]=6,
 [1800]=6,
 [1801]=6,
 [1802]=6,
 [1803]=6,
 [1804]=6,
 [1805]=6,
 [1808]=3,
 [1809]=5,
 [1810]=2,
 [1811]=2,
 [1812]=2,
 [1813]=3,
 [1814]=3,
 [1815]=3,
 [1816]=3,
 [1817]=3,
 [1818]=2,
 [1819]=2,
 [1820]=2,
 [1821]=2,
 [1822]=3,
 [1823]=2,
 [1824]=2,
 [1825]=2,
 [1826]=2,
 [1827]=2,
 [1828]=2,
 [1829]=2,
 [1830]=2,
 [1831]=2,
 [1832]=3,
 [1833]=2,
 [1834]=3,
 [1835]=2,
 [1836]=3,
 [1837]=2,
 [1838]=2,
 [1839]=3,
 [1840]=5,
 [1841]=5,
 [1842]=5,
 [1843]=5,
 [1844]=5,
 [1845]=5,
 [1846]=5,
 [1847]=5,
 [1848]=5,
 [1849]=5,
 [1850]=5,
 [1851]=5,
 [1852]=5,
 [1853]=5,
 [1854]=5,
 [1855]=5,
 [1856]=5,
 [1857]=5,
 [1858]=5,
 [1859]=5,
 [1860]=5,
 [1861]=5,
 [1862]=5,
 [1863]=5,
 [1864]=5,
 [1865]=5,
 [1866]=5,
 [1869]=3,
 [1870]=2,
 [1871]=2,
 [1872]=2,
 [1873]=2,
 [1874]=2,
 [1875]=2,
 [1876]=2,
 [1877]=2,
 [1878]=2,
 [1879]=2,
 [1880]=2,
 [1881]=3,
 [1882]=3,
 [1883]=3,
 [1884]=2,
 [1885]=2,
 [1886]=2,
 [1887]=2,
 [1888]=2,
 [1889]=2,
 [1890]=2,
 [1891]=2,
 [1892]=2,
 [1893]=2,
 [1894]=2,
 [1895]=2,
 [1896]=2,
 [1897]=2,
 [1898]=2,
 [1899]=3,
 [1900]=3,
 [1901]=2,
 [1902]=2,
 [1903]=2,
 [1904]=2,
 [1905]=3,
 [1906]=2,
 [1907]=3,
 [1908]=3,
 [1909]=2,
 [1910]=2,
 [1911]=2,
 [1912]=3,
 [1913]=3,
 [1914]=2,
 [1915]=2,
 [1916]=2,
 [1917]=2,
 [1918]=2,
 [1919]=2,
 [1958]=5,
 [1959]=5,
 [1960]=5,
 [1961]=5,
 [1962]=5,
 [1963]=5,
 [1964]=5,
 [1965]=5,
 [1966]=5,
 [1967]=5,
 [1968]=5,
 [1984]=6,
 [1985]=6,
 [1986]=6,
 [1987]=6,
 [1988]=6,
 [1989]=6,
 [1990]=6,
 [1991]=6,
 [1992]=6,
 [1993]=6,
 [1994]=2,
 [1995]=2,
 [1996]=2,
 [1997]=2,
 [1998]=2,
 [1999]=2,
 [2000]=2,
 [2001]=2,
 [2002]=2,
 [2003]=2,
 [2004]=2,
 [2005]=2,
 [2006]=2,
 [2007]=2,
 [2008]=2,
 [2009]=2,
 [2010]=2,
 [2011]=2,
 [2012]=2,
 [2013]=2,
 [2014]=2,
 [2015]=2,
 [2016]=2,
 [2017]=2,
 [2018]=2,
 [2019]=2,
 [2020]=2,
 [2021]=2,
 [2022]=2,
 [2023]=2,
 [2024]=2,
 [2025]=2,
 [2026]=2,
 [2027]=5,
 [2028]=5,
 [2029]=5,
 [2030]=5,
 [2031]=5,
 [2032]=5,
 [2033]=5,
 [2034]=5,
 [2035]=5,
 [2036]=6,
 [2037]=6,
 [2038]=6,
 [2039]=6,
 [2040]=6,
 [2041]=6,
 [2042]=2,
 [2045]=5,
 [2046]=6,
 [2047]=6,
 [2070]=5,
 [2071]=5,
 [2072]=5,
 [2073]=5,
 [2075]=5,
 [2076]=5,
 [2077]=5,
 [2078]=5,
 [2079]=5,
 [2080]=5,
 [2081]=5,
 [2082]=5,
 [2083]=5,
 [2085]=5,
 [2086]=5,
 [2087]=5,
 [2089]=5,
 [2090]=5,
 [2091]=5,
 [2092]=5,
 [2093]=5,
 [2112]=3,
 [2113]=2,
 [2114]=2,
 [2115]=2,
 [2116]=2,
 [2117]=2,
 [2118]=3,
 [2119]=3,
 [2120]=2,
 [2121]=3,
 [2122]=2,
 [2123]=2,
 [2124]=2,
 [2125]=2,
 [2126]=2,
 [2127]=2,
 [2128]=2,
 [2129]=2,
 [2130]=2,
 [2131]=2,
 [2132]=3,
 [2133]=2,
 [2134]=3,
 [2135]=3,
 [2136]=3,
 [2137]=5,
 [2138]=5,
 [2139]=5,
 [2144]=2,
 [2145]=4,
 [2146]=2,
 [2147]=2,
 [2148]=2,
 [2149]=2,
 [2150]=4,
 [2151]=3,
 [2152]=2,
 [2153]=3,
 [2154]=3,
 [2160]=3,
 [2161]=3,
 [2162]=3,
 [2163]=3,
 [2164]=3,
 [2165]=3,
 [2166]=3,
 [2167]=3,
 [2168]=3,
 [2169]=3,
 [2170]=3,
 [2171]=3,
 [2172]=3,
 [2173]=3,
 [2174]=3,
 [2175]=3,
 [2176]=3,
 [2177]=3,
 [2178]=3,
 [2179]=2,
 [2180]=2,
 [2181]=2,
 [2182]=2,
 [2183]=4,
 [2184]=4,
 [2185]=2,
 [2186]=2,
 [2187]=2,
 [2188]=2,
 [2189]=2,
 [2190]=3,
 [2192]=4,
 [2193]=4,
 [2200]=5,
 [2201]=5,
 [2202]=5,
 [2203]=5,
 [2204]=5,
 [2205]=5,
 [2206]=5,
 [2207]=5,
 [2208]=2,
 [2209]=2,
 [2210]=2,
 [2211]=2,
 [2212]=2,
 [2213]=2,
 [2214]=2,
 [2215]=2,
 [2216]=2,
 [2217]=2,
 [2218]=3,
 [2219]=3,
 [2220]=3,
 [2221]=4,
 [2222]=3,
 [2223]=2,
 [2224]=2,
 [2225]=3,
 [2226]=3,
 [2227]=2,
 [2228]=2,
 [2229]=2,
 [2230]=2,
 [2231]=2,
 [2232]=2,
 [2233]=3,
 [2234]=2,
 [2235]=2,
 [2236]=2,
 [2237]=2,
 [2238]=2,
 [2239]=2,
 [2240]=2,
 [2241]=2,
 [2242]=2,
 [2243]=2,
 [2244]=2,
 [2245]=2,
 [2246]=2,
 [2247]=2,
 [2248]=2,
 [2250]=5,
 [2251]=5,
 [2252]=5,
 [2253]=5,
 [2254]=5,
 [2255]=5,
 [2256]=5,
 [2257]=5,
 [2258]=5,
 [2259]=5,
 [2260]=5,
 [2261]=5,
 [2262]=5,
 [2263]=5,
 [2264]=5,
 [2265]=5,
 [2266]=5,
 [2267]=5,
 [2268]=5,
 [2269]=5,
 [2270]=5,
 [2271]=5,
 [2272]=5,
 [2273]=5,
 [2274]=4,
 [2275]=5,
 [2276]=5,
 [2277]=5,
 [2278]=5,
 [2279]=5,
 [2280]=5,
 [2281]=5,
 [2282]=5,
 [2283]=5,
 [2284]=5,
 [2285]=5,
 [2286]=5,
 [2287]=5,
 [2288]=5,
 [2289]=5,
 [2290]=5,
 [2291]=5,
 [2292]=5,
 [2293]=5,
 [2294]=5,
 [2295]=5,
 [2296]=5,
 [2297]=5,
 [2298]=5,
 [2299]=5,
 [2300]=5,
 [2301]=5,
 [2302]=5,
 [2303]=5,
 [2304]=5,
 [2305]=5,
 [2306]=5,
 [2362]=5,
 [2364]=5,
 [2369]=5,
 [2370]=5,
 [2371]=5,
 [2372]=5,
 [2373]=5,
 [2374]=5,
 [2375]=5,
 [2376]=5,
 [2381]=5,
 [2385]=5,
 [2386]=5,
 [2387]=5,
 [2388]=5,
 [2389]=5,
 [2390]=5,
 [2391]=5,
 [2402]=5,
 [2403]=5,
 [2433]=5,
 [2492]=5,
 [2497]=5,
 [2498]=5,
 [2499]=5,
 [2500]=5,
 [2509]=5,
 [2530]=5,
 [2531]=5,
 [2558]=5,
 [2561]=5,
 [2562]=5,
 [2620]=5,
 [2625]=5,
 [2626]=5,
 [2631]=5,
 [2632]=5,
 [2635]=5,
 [2636]=5,
 [2637]=5,
 [2641]=5,
 [2672]=5,
 [2673]=5,
 [2677]=5,
 [2689]=5,
 [2690]=5,
 [2748]=5,
 [2753]=5,
 [2754]=5,
 [2755]=5,
 [2756]=5,
 [2757]=5,
 [2759]=5,
 [2760]=5,
 [2765]=5,
 [2786]=5,
 [2787]=5,
 [2810]=5,
 [2811]=5,
 [2812]=5,
 [2813]=5,
 [2814]=5,
 [2815]=5,
 [2817]=5,
 [2876]=5,
 [2879]=5,
 [2881]=5,
 [2882]=5,
 [2883]=5,
 [2884]=5,
 [2893]=5,
 [2901]=5,
 [2902]=5,
 [2914]=5,
 [2915]=5,
 [2946]=5,
 [3008]=5,
 [3021]=5,
 [3072]=5,
 [3076]=5,
 [3132]=5,
 [3134]=5,
 [3135]=5,
 [3136]=5,
 [3142]=5,
 [3143]=5,
 [3144]=5,
 [3146]=5,
 [3147]=5,
 [3148]=5,
 [3149]=5,
 [3157]=5,
 [3158]=5,
 [3170]=5,
 [3171]=5,
 [3201]=5,
 [3260]=5,
 [3263]=5,
 [3270]=5,
 [3276]=5,
 [3277]=5,
 [3298]=5,
 [3299]=5,
 [3328]=5,
 [3329]=5,
 [3387]=5,
 [3388]=5,
 [3393]=5,
 [3394]=5,
 [3395]=5,
 [3396]=5,
 [3405]=5,
 [3426]=5,
 [3427]=5,
 [3457]=5,
 [3530]=5,
 [3538]=5,
 [3539]=5,
 [3540]=5,
 [3542]=5,
 [3633]=5,
 [3636]=5,
 [3637]=5,
 [3638]=5,
 [3639]=5,
 [3640]=5,
 [3641]=5,
 [3642]=5,
 [3655]=5,
 [3656]=5,
 [3657]=5,
 [3658]=5,
 [3659]=5,
 [3660]=5,
 [3661]=5,
 [3662]=5,
 [3761]=5,
 [3764]=5,
 [3765]=5,
 [3766]=5,
 [3767]=5,
 [3768]=5,
 [3769]=5,
 [3770]=5,
 [3771]=5,
 [3772]=5,
 [3784]=5,
 [3785]=5,
 [3786]=5,
 [3787]=5,
 [3788]=5,
 [3789]=5,
 [3864]=5,
 [3865]=5,
 [3893]=5,
 [3895]=5,
 [3897]=5,
 [3953]=5,
 [3954]=5,
 [3955]=5,
 [3956]=5,
 [3957]=5,
 [3958]=5,
 [3959]=5,
 [3960]=5,
 [3961]=5,
 [3962]=5,
 [3963]=5,
 [3964]=5,
 [3965]=5,
 [3966]=5,
 [3968]=5,
 [3969]=5,
 [3970]=5,
 [3971]=5,
 [3972]=5,
 [3974]=5,
 [3975]=5,
 [3981]=5,
 [3982]=5,
 [3983]=5,
 [3984]=5,
 [3985]=5,
 [3986]=5,
 [3987]=5,
 [3988]=5,
 [3989]=5,
 [3990]=5,
 [3991]=5,
 [3993]=5,
 [3994]=5,
 [3995]=5,
 [3996]=5,
 [3997]=5,
 [3998]=5,
 [3999]=5,
 [4000]=5,
 [4001]=5,
 [4002]=5,
 [4003]=5,
 [4004]=5,
 [4005]=5,
 [4006]=5,
 [4007]=5,
 [4008]=5,
 [4009]=5,
 [4010]=5,
 [4011]=5,
 [4012]=5,
 [4013]=5,
 [4014]=5,
 [4015]=5,
 [4016]=5,
 [4017]=5,
 [4018]=5,
 [4019]=5,
 [4020]=5,
 [4021]=5,
 [4022]=5,
 [4023]=5,
 [4024]=5,
 [4025]=5,
 [4026]=5,
 [4027]=5,
 [4028]=5,
 [4038]=5,
 [4141]=5,
 [4142]=5,
 [4143]=5,
 [4144]=5,
 [4146]=5,
 [4147]=5,
 [4148]=5,
 [4149]=5,
 [4150]=5,
 [4151]=5,
 [4153]=5,
 [4154]=5,
 [4157]=5,
 [4158]=5,
 [4184]=5,
 [4185]=5,
 [4190]=5,
 [4191]=5,
 [4192]=5,
 [4209]=5,
 [4210]=5,
 [4211]=5,
 [4212]=5,
 [4226]=5,
 [4229]=5,
 [4230]=5,
 [4237]=5,
 [4253]=5,
 [4957]=5,
 [4958]=5,
 [4959]=5,
 [5906]=5,
 [5907]=5,
 [5908]=5,
 [5938]=5,
 [5939]=5,
 [5940]=5,
 [5970]=5,
 [5971]=5,
 [6002]=5,
 [6003]=5,
 [6071]=5,
 [6072]=5,
 [6073]=5,
 [6074]=5,
 [6075]=5,
 [6076]=5,
 [6077]=5,
 [6086]=5,
 [6089]=5,
 [6090]=5,
 [6091]=5,
 [6092]=5,
 [6093]=5,
 [6094]=5,
 [6095]=5,
 [6096]=5,
 [6097]=5,
 [6098]=5,
 [6099]=5,
 [6109]=5,
 [6150]=4,
 [6151]=2,
 [6154]=2,
 [6155]=5,
 [6156]=5,
 [6157]=5,
 [6158]=4,
 [6159]=5,
 [6176]=2,
 [6177]=2,
 [6178]=2,
 [6179]=2,
 [6180]=2,
 [6181]=2,
 [6182]=2,
 [6183]=2,
 [6184]=2,
 [6185]=2,
 [6186]=2,
 [6187]=2,
 [6188]=2,
 [6189]=2,
 [6190]=2,
 [6191]=2,
 [6192]=2,
 [6193]=2,
 [6194]=2,
 [6195]=2,
 [6196]=2,
 [6197]=2,
 [6198]=2,
 [6199]=2,
 [6200]=2,
 [6201]=2,
 [6202]=2,
 [6203]=2,
 [6204]=2,
 [6205]=2,
 [6206]=2,
 [6207]=2,
 [6208]=2,
 [6209]=2,
 [6210]=2,
 [6211]=2,
 [6212]=2,
 [6213]=2,
 [6214]=2,
 [6215]=2,
 [6216]=2,
 [6217]=2,
 [6218]=2,
 [6219]=2,
 [6220]=2,
 [6221]=2,
 [6222]=2,
 [6223]=2,
 [6224]=2,
 [6225]=2,
 [6226]=2,
 [6227]=2,
 [6228]=2,
 [6229]=2,
 [6230]=2,
 [6231]=2,
 [6232]=2,
 [6233]=2,
 [6234]=2,
 [6235]=2,
 [6236]=2,
 [6237]=2,
 [6238]=2,
 [6239]=2,
 [6240]=2,
 [6241]=2,
 [6242]=2,
 [6243]=2,
 [6244]=2,
 [6245]=2,
 [6246]=2,
 [6247]=2,
 [6248]=2,
 [6249]=2,
 [6250]=2,
 [6251]=2,
 [6252]=2,
 [6253]=2,
 [6254]=2,
 [6255]=2,
 [6256]=2,
 [6257]=2,
 [6258]=2,
 [6259]=2,
 [6260]=2,
 [6261]=2,
 [6262]=2,
 [6263]=2,
 [6264]=2,
 [6272]=4,
 [6273]=4,
 [6274]=4,
 [6275]=4,
 [6276]=4,
 [6279]=2,
 [6280]=2,
 [6281]=2,
 [6282]=2,
 [6283]=2,
 [6284]=2,
 [6285]=2,
 [6286]=2,
 [6287]=2,
 [6288]=2,
 [6289]=2,
 [6290]=2,
 [6291]=2,
 [6292]=2,
 [6293]=2,
 [6294]=2,
 [6295]=2,
 [6296]=2,
 [6297]=2,
 [6298]=2,
 [6299]=2,
 [6300]=2,
 [6301]=2,
 [6302]=2,
 [6303]=2,
 [6304]=2,
 [6305]=2,
 [6306]=2,
 [6307]=2,
 [6308]=2,
 [6309]=2,
 [6310]=2,
 [6311]=2,
 [6312]=2,
 [6313]=5,
 [6314]=2,
 [6432]=5,
 [6433]=5,
 [6434]=5,
 [6439]=5,
 [6440]=5,
 [6450]=5,
 [6457]=5,
 [6458]=5,
 [6459]=5,
 [6679]=5,
 [6680]=5,
 [6742]=5,
 [6744]=5,
 [6745]=5,
 [6746]=5,
 [6747]=5,
 [6748]=5,
 [6749]=5,
 [6750]=5,
 [6752]=5,
 [6754]=5,
 [6757]=5,
 [6758]=5,
 [6759]=5,
 [6760]=5,
 [6761]=5,
 [6762]=5,
 [6763]=5,
 [6764]=5,
 [6771]=5,
 [6772]=5,
 [6773]=5,
 [6774]=5,
 [6775]=5,
 [6776]=5,
 [6777]=5,
 [6778]=5,
 [6779]=5,
 [6780]=5,
 [6783]=5,
 [6832]=5,
 [6833]=5,
 [6834]=5,
 [6835]=5,
 [6836]=5,
 [6837]=5,
 [6838]=5,
 [6839]=5,
 [6840]=5,
 [6841]=5,
 [6842]=5,
 [6843]=5,
 [6844]=5,
 [6845]=5,
 [6847]=5,
 [6848]=5,
 [6849]=5,
 [6850]=5,
 [6851]=5,
 [6852]=5,
 [6853]=5,
 [6854]=5,
 [6855]=5,
 [6856]=5,
 [6857]=5,
 [6858]=5,
 [6859]=5,
 [6860]=5,
 [6861]=5,
 [6862]=5,
 [6912]=5,
 [6913]=5,
 [6914]=5,
 [6915]=5,
 [6964]=5,
 [6966]=5,
 [6967]=5,
 [6968]=5,
 [6969]=5,
 [6970]=5,
 [6972]=5,
 [6978]=5,
 [7019]=5,
 [7020]=5,
 [7021]=5,
 [7022]=5,
 [7023]=5,
 [7024]=5,
 [7025]=5,
 [7026]=5,
 [7027]=5,
 [7040]=5,
 [7041]=5,
 [7074]=5,
 [7075]=5,
 [7076]=5,
 [7077]=5,
 [7080]=5,
 [7081]=5,
 [7083]=5,
 [7142]=5,
 [7144]=5,
 [7145]=5,
 [7149]=5,
 [7151]=5,
 [7152]=5,
 [7153]=5,
 [7212]=5,
 [7213]=5,
 [7214]=5,
 [7215]=5,
 [7216]=5,
 [7217]=5,
 [7218]=5,
 [7219]=5,
 [7222]=5,
 [7223]=5,
 [7376]=5,
 [7377]=5,
 [7378]=5,
 [7380]=5,
 [7381]=5,
 [7382]=5,
 [7383]=5,
 [7384]=5,
 [7385]=5,
 [7386]=5,
 [7387]=5,
 [7388]=5,
 [7389]=5,
 [7390]=5,
 [7391]=5,
 [7392]=5,
 [7394]=5,
 [7395]=5,
 [7396]=5,
 [7397]=5,
 [7398]=5,
 [7399]=5,
 [7400]=5,
 [7405]=5,
 [7412]=5,
 [7416]=5,
 [7417]=5,
 [7616]=5,
 [7617]=5,
 [7618]=5,
 [7619]=5,
 [7620]=5,
 [7621]=5,
 [7622]=5,
 [7623]=5,
 [7624]=5,
 [7625]=5,
 [7626]=5,
 [7627]=5,
 [7628]=5,
 [7629]=5,
 [7630]=5,
 [7631]=5,
 [7632]=5,
 [7633]=5,
 [7634]=5,
 [7635]=5,
 [7636]=5,
 [7637]=5,
 [7638]=5,
 [7639]=5,
 [7640]=5,
 [7641]=5,
 [7642]=5,
 [7643]=5,
 [7644]=5,
 [7645]=5,
 [7646]=5,
 [7647]=5,
 [7648]=5,
 [7649]=5,
 [7650]=5,
 [7651]=5,
 [7652]=5,
 [7653]=5,
 [7654]=5,
 [7655]=5,
 [7656]=5,
 [7657]=5,
 [7658]=5,
 [7659]=5,
 [7660]=5,
 [7661]=5,
 [7662]=5,
 [7663]=5,
 [7664]=5,
 [7665]=5,
 [7666]=5,
 [7667]=5,
 [7668]=5,
 [7669]=5,
 [7670]=5,
 [7671]=5,
 [7672]=5,
 [7673]=5,
 [7674]=5,
 [7675]=5,
 [7676]=5,
 [7677]=5,
 [7678]=5,
 [7679]=5,
 [8204]=4,
 [8205]=2,
 [8239]=4,
 [8294]=4,
 [8295]=4,
 [8296]=4,
 [8297]=4,
 [8400]=5,
 [8401]=5,
 [8402]=5,
 [8403]=5,
 [8404]=5,
 [8405]=5,
 [8406]=5,
 [8407]=5,
 [8408]=5,
 [8409]=5,
 [8410]=5,
 [8411]=5,
 [8412]=5,
 [8417]=5,
 [8421]=5,
 [8422]=5,
 [8423]=5,
 [8424]=5,
 [8425]=5,
 [8426]=5,
 [8427]=5,
 [8428]=5,
 [8429]=5,
 [8430]=5,
 [8431]=5,
 [8432]=5,
 [11503]=5,
 [11504]=5,
 [11505]=5,
 [11647]=5,
 [11744]=5,
 [11745]=5,
 [11746]=5,
 [11747]=5,
 [11748]=5,
 [11749]=5,
 [11750]=5,
 [11751]=5,
 [11752]=5,
 [11753]=5,
 [11754]=5,
 [11755]=5,
 [11756]=5,
 [11757]=5,
 [11758]=5,
 [11759]=5,
 [11760]=5,
 [11761]=5,
 [11762]=5,
 [11763]=5,
 [11764]=5,
 [11765]=5,
 [11766]=5,
 [11767]=5,
 [11768]=5,
 [11769]=5,
 [11770]=5,
 [11771]=5,
 [11772]=5,
 [11773]=5,
 [11774]=5,
 [11775]=5,
 [12330]=5,
 [12331]=5,
 [12332]=5,
 [12333]=5,
 [12334]=5,
 [12335]=5,
 [12441]=5,
 [12442]=5,
 [42607]=5,
 [42612]=5,
 [42613]=5,
 [42614]=5,
 [42615]=5,
 [42616]=5,
 [42617]=5,
 [42618]=5,
 [42619]=5,
 [42620]=5,
 [42621]=5,
 [42654]=5,
 [42655]=5,
 [42736]=5,
 [42737]=5,
 [43014]=5,
 [43019]=5,
 [43045]=5,
 [43046]=5,
 [43052]=5,
 [43072]=2,
 [43073]=2,
 [43074]=2,
 [43075]=2,
 [43076]=2,
 [43077]=2,
 [43078]=2,
 [43079]=2,
 [43080]=2,
 [43081]=2,
 [43082]=2,
 [43083]=2,
 [43084]=2,
 [43085]=2,
 [43086]=2,
 [43087]=2,
 [43088]=2,
 [43089]=2,
 [43090]=2,
 [43091]=2,
 [43092]=2,
 [43093]=2,
 [43094]=2,
 [43095]=2,
 [43096]=2,
 [43097]=2,
 [43098]=2,
 [43099]=2,
 [43100]=2,
 [43101]=2,
 [43102]=2,
 [43103]=2,
 [43104]=2,
 [43105]=2,
 [43106]=2,
 [43107]=2,
 [43108]=2,
 [43109]=2,
 [43110]=2,
 [43111]=2,
 [43112]=2,
 [43113]=2,
 [43114]=2,
 [43115]=2,
 [43116]=2,
 [43117]=2,
 [43118]=2,
 [43119]=2,
 [43120]=2,
 [43121]=2,
 [43122]=1,
 [43123]=4,
 [43204]=5,
 [43205]=5,
 [43232]=5,
 [43233]=5,
 [43234]=5,
 [43235]=5,
 [43236]=5,
 [43237]=5,
 [43238]=5,
 [43239]=5,
 [43240]=5,
 [43241]=5,
 [43242]=5,
 [43243]=5,
 [43244]=5,
 [43245]=5,
 [43246]=5,
 [43247]=5,
 [43248]=5,
 [43249]=5,
 [43263]=5,
 [43302]=5,
 [43303]=5,
 [43304]=5,
 [43305]=5,
 [43306]=5,
 [43307]=5,
 [43308]=5,
 [43309]=5,
 [43335]=5,
 [43336]=5,
 [43337]=5,
 [43338]=5,
 [43339]=5,
 [43340]=5,
 [43341]=5,
 [43342]=5,
 [43343]=5,
 [43344]=5,
 [43345]=5,
 [43392]=5,
 [43393]=5,
 [43394]=5,
 [43443]=5,
 [43446]=5,
 [43447]=5,
 [43448]=5,
 [43449]=5,
 [43452]=5,
 [43493]=5,
 [43561]=5,
 [43562]=5,
 [43563]=5,
 [43564]=5,
 [43565]=5,
 [43566]=5,
 [43569]=5,
 [43570]=5,
 [43573]=5,
 [43574]=5,
 [43587]=5,
 [43596]=5,
 [43644]=5,
 [43696]=5,
 [43698]=5,
 [43699]=5,
 [43700]=5,
 [43703]=5,
 [43704]=5,
 [43710]=5,
 [43711]=5,
 [43713]=5,
 [43756]=5,
 [43757]=5,
 [43766]=5,
 [44005]=5,
 [44008]=5,
 [44013]=5,
 [64286]=5,
 [65056]=5,
 [65057]=5,
 [65058]=5,
 [65059]=5,
 [65060]=5,
 [65061]=5,
 [65062]=5,
 [65063]=5,
 [65064]=5,
 [65065]=5,
 [65066]=5,
 [65067]=5,
 [65068]=5,
 [65069]=5,
 [65070]=5,
 [65071]=5,
 [66045]=5,
 [66272]=5,
 [66422]=5,
 [66423]=5,
 [66424]=5,
 [66425]=5,
 [66426]=5,
 [68097]=5,
 [68098]=5,
 [68099]=5,
 [68101]=5,
 [68102]=5,
 [68108]=5,
 [68109]=5,
 [68110]=5,
 [68111]=5,
 [68152]=5,
 [68153]=5,
 [68154]=5,
 [68159]=5,
 [68288]=2,
 [68289]=2,
 [68290]=2,
 [68291]=2,
 [68292]=2,
 [68293]=3,
 [68294]=4,
 [68295]=3,
 [68296]=4,
 [68297]=3,
 [68298]=3,
 [68299]=4,
 [68300]=4,
 [68301]=1,
 [68302]=3,
 [68303]=3,
 [68304]=3,
 [68305]=3,
 [68306]=3,
 [68307]=2,
 [68308]=2,
 [68309]=2,
 [68310]=2,
 [68311]=1,
 [68312]=2,
 [68313]=2,
 [68314]=2,
 [68315]=2,
 [68316]=2,
 [68317]=3,
 [68318]=2,
 [68319]=2,
 [68320]=2,
 [68321]=3,
 [68322]=4,
 [68323]=4,
 [68324]=3,
 [68325]=5,
 [68326]=5,
 [68331]=2,
 [68332]=2,
 [68333]=2,
 [68334]=2,
 [68335]=3,
 [68480]=2,
 [68481]=3,
 [68482]=2,
 [68483]=3,
 [68484]=3,
 [68485]=3,
 [68486]=2,
 [68487]=2,
 [68488]=2,
 [68489]=3,
 [68490]=2,
 [68491]=2,
 [68492]=3,
 [68493]=2,
 [68494]=3,
 [68495]=3,
 [68496]=2,
 [68497]=3,
 [68521]=3,
 [68522]=3,
 [68523]=3,
 [68524]=3,
 [68525]=2,
 [68526]=2,
 [68527]=4,
 [68864]=1,
 [68865]=2,
 [68866]=2,
 [68867]=2,
 [68868]=2,
 [68869]=2,
 [68870]=2,
 [68871]=2,
 [68872]=2,
 [68873]=2,
 [68874]=2,
 [68875]=2,
 [68876]=2,
 [68877]=2,
 [68878]=2,
 [68879]=2,
 [68880]=2,
 [68881]=2,
 [68882]=2,
 [68883]=2,
 [68884]=2,
 [68885]=2,
 [68886]=2,
 [68887]=2,
 [68888]=2,
 [68889]=2,
 [68890]=2,
 [68891]=2,
 [68892]=2,
 [68893]=2,
 [68894]=2,
 [68895]=2,
 [68896]=2,
 [68897]=2,
 [68898]=3,
 [68899]=2,
 [68900]=5,
 [68901]=5,
 [68902]=5,
 [68903]=5,
 [69291]=5,
 [69292]=5,
 [69424]=2,
 [69425]=2,
 [69426]=2,
 [69427]=3,
 [69428]=2,
 [69429]=2,
 [69430]=2,
 [69431]=2,
 [69432]=2,
 [69433]=2,
 [69434]=2,
 [69435]=2,
 [69436]=2,
 [69437]=2,
 [69438]=2,
 [69439]=2,
 [69440]=2,
 [69441]=2,
 [69442]=2,
 [69443]=2,
 [69444]=2,
 [69445]=4,
 [69446]=5,
 [69447]=5,
 [69448]=5,
 [69449]=5,
 [69450]=5,
 [69451]=5,
 [69452]=5,
 [69453]=5,
 [69454]=5,
 [69455]=5,
 [69456]=5,
 [69457]=2,
 [69458]=2,
 [69459]=2,
 [69460]=3,
 [69488]=2,
 [69489]=2,
 [69490]=2,
 [69491]=2,
 [69492]=3,
 [69493]=3,
 [69494]=2,
 [69495]=2,
 [69496]=2,
 [69497]=2,
 [69498]=2,
 [69499]=2,
 [69500]=2,
 [69501]=2,
 [69502]=2,
 [69503]=2,
 [69504]=2,
 [69505]=2,
 [69506]=5,
 [69507]=5,
 [69508]=5,
 [69509]=5,
 [69552]=2,
 [69553]=4,
 [69554]=2,
 [69555]=2,
 [69556]=3,
 [69557]=3,
 [69558]=3,
 [69559]=4,
 [69560]=2,
 [69561]=3,
 [69562]=3,
 [69563]=2,
 [69564]=2,
 [69565]=3,
 [69566]=2,
 [69567]=2,
 [69568]=4,
 [69569]=2,
 [69570]=3,
 [69571]=3,
 [69572]=2,
 [69573]=4,
 [69574]=4,
 [69575]=4,
 [69576]=4,
 [69577]=3,
 [69578]=2,
 [69579]=1,
 [69633]=5,
 [69688]=5,
 [69689]=5,
 [69690]=5,
 [69691]=5,
 [69692]=5,
 [69693]=5,
 [69694]=5,
 [69695]=5,
 [69696]=5,
 [69697]=5,
 [69698]=5,
 [69699]=5,
 [69700]=5,
 [69701]=5,
 [69702]=5,
 [69744]=5,
 [69747]=5,
 [69748]=5,
 [69759]=5,
 [69760]=5,
 [69761]=5,
 [69811]=5,
 [69812]=5,
 [69813]=5,
 [69814]=5,
 [69817]=5,
 [69818]=5,
 [69821]=4,
 [69826]=5,
 [69837]=4,
 [69888]=5,
 [69889]=5,
 [69890]=5,
 [69927]=5,
 [69928]=5,
 [69929]=5,
 [69930]=5,
 [69931]=5,
 [69933]=5,
 [69934]=5,
 [69935]=5,
 [69936]=5,
 [69937]=5,
 [69938]=5,
 [69939]=5,
 [69940]=5,
 [70003]=5,
 [70016]=5,
 [70017]=5,
 [70070]=5,
 [70071]=5,
 [70072]=5,
 [70073]=5,
 [70074]=5,
 [70075]=5,
 [70076]=5,
 [70077]=5,
 [70078]=5,
 [70090]=5,
 [70091]=5,
 [70092]=5,
 [70095]=5,
 [70191]=5,
 [70192]=5,
 [70193]=5,
 [70196]=5,
 [70198]=5,
 [70199]=5,
 [70206]=5,
 [70367]=5,
 [70371]=5,
 [70372]=5,
 [70373]=5,
 [70374]=5,
 [70375]=5,
 [70376]=5,
 [70377]=5,
 [70378]=5,
 [70400]=5,
 [70401]=5,
 [70459]=5,
 [70460]=5,
 [70464]=5,
 [70502]=5,
 [70503]=5,
 [70504]=5,
 [70505]=5,
 [70506]=5,
 [70507]=5,
 [70508]=5,
 [70512]=5,
 [70513]=5,
 [70514]=5,
 [70515]=5,
 [70516]=5,
 [70712]=5,
 [70713]=5,
 [70714]=5,
 [70715]=5,
 [70716]=5,
 [70717]=5,
 [70718]=5,
 [70719]=5,
 [70722]=5,
 [70723]=5,
 [70724]=5,
 [70726]=5,
 [70750]=5,
 [70835]=5,
 [70836]=5,
 [70837]=5,
 [70838]=5,
 [70839]=5,
 [70840]=5,
 [70842]=5,
 [70847]=5,
 [70848]=5,
 [70850]=5,
 [70851]=5,
 [71090]=5,
 [71091]=5,
 [71092]=5,
 [71093]=5,
 [71100]=5,
 [71101]=5,
 [71103]=5,
 [71104]=5,
 [71132]=5,
 [71133]=5,
 [71219]=5,
 [71220]=5,
 [71221]=5,
 [71222]=5,
 [71223]=5,
 [71224]=5,
 [71225]=5,
 [71226]=5,
 [71229]=5,
 [71231]=5,
 [71232]=5,
 [71339]=5,
 [71341]=5,
 [71344]=5,
 [71345]=5,
 [71346]=5,
 [71347]=5,
 [71348]=5,
 [71349]=5,
 [71351]=5,
 [71453]=5,
 [71454]=5,
 [71455]=5,
 [71458]=5,
 [71459]=5,
 [71460]=5,
 [71461]=5,
 [71463]=5,
 [71464]=5,
 [71465]=5,
 [71466]=5,
 [71467]=5,
 [71727]=5,
 [71728]=5,
 [71729]=5,
 [71730]=5,
 [71731]=5,
 [71732]=5,
 [71733]=5,
 [71734]=5,
 [71735]=5,
 [71737]=5,
 [71738]=5,
 [71995]=5,
 [71996]=5,
 [71998]=5,
 [72003]=5,
 [72148]=5,
 [72149]=5,
 [72150]=5,
 [72151]=5,
 [72154]=5,
 [72155]=5,
 [72160]=5,
 [72193]=5,
 [72194]=5,
 [72195]=5,
 [72196]=5,
 [72197]=5,
 [72198]=5,
 [72201]=5,
 [72202]=5,
 [72243]=5,
 [72244]=5,
 [72245]=5,
 [72246]=5,
 [72247]=5,
 [72248]=5,
 [72251]=5,
 [72252]=5,
 [72253]=5,
 [72254]=5,
 [72263]=5,
 [72273]=5,
 [72274]=5,
 [72275]=5,
 [72276]=5,
 [72277]=5,
 [72278]=5,
 [72281]=5,
 [72282]=5,
 [72283]=5,
 [72330]=5,
 [72331]=5,
 [72332]=5,
 [72333]=5,
 [72334]=5,
 [72335]=5,
 [72336]=5,
 [72337]=5,
 [72338]=5,
 [72339]=5,
 [72340]=5,
 [72341]=5,
 [72342]=5,
 [72344]=5,
 [72345]=5,
 [72752]=5,
 [72753]=5,
 [72754]=5,
 [72755]=5,
 [72756]=5,
 [72757]=5,
 [72758]=5,
 [72760]=5,
 [72761]=5,
 [72762]=5,
 [72763]=5,
 [72764]=5,
 [72765]=5,
 [72767]=5,
 [72850]=5,
 [72851]=5,
 [72852]=5,
 [72853]=5,
 [72854]=5,
 [72855]=5,
 [72856]=5,
 [72857]=5,
 [72858]=5,
 [72859]=5,
 [72860]=5,
 [72861]=5,
 [72862]=5,
 [72863]=5,
 [72864]=5,
 [72865]=5,
 [72866]=5,
 [72867]=5,
 [72868]=5,
 [72869]=5,
 [72870]=5,
 [72871]=5,
 [72874]=5,
 [72875]=5,
 [72876]=5,
 [72877]=5,
 [72878]=5,
 [72879]=5,
 [72880]=5,
 [72882]=5,
 [72883]=5,
 [72885]=5,
 [72886]=5,
 [73009]=5,
 [73010]=5,
 [73011]=5,
 [73012]=5,
 [73013]=5,
 [73014]=5,
 [73018]=5,
 [73020]=5,
 [73021]=5,
 [73023]=5,
 [73024]=5,
 [73025]=5,
 [73026]=5,
 [73027]=5,
 [73028]=5,
 [73029]=5,
 [73031]=5,
 [73104]=5,
 [73105]=5,
 [73109]=5,
 [73111]=5,
 [73459]=5,
 [73460]=5,
 [92912]=5,
 [92913]=5,
 [92914]=5,
 [92915]=5,
 [92916]=5,
 [92976]=5,
 [92977]=5,
 [92978]=5,
 [92979]=5,
 [92980]=5,
 [92981]=5,
 [92982]=5,
 [94031]=5,
 [94095]=5,
 [94096]=5,
 [94097]=5,
 [94098]=5,
 [94180]=5,
 [113821]=5,
 [113822]=5,
 [118528]=5,
 [118529]=5,
 [118530]=5,
 [118531]=5,
 [118532]=5,
 [118533]=5,
 [118534]=5,
 [118535]=5,
 [118536]=5,
 [118537]=5,
 [118538]=5,
 [118539]=5,
 [118540]=5,
 [118541]=5,
 [118542]=5,
 [118543]=5,
 [118544]=5,
 [118545]=5,
 [118546]=5,
 [118547]=5,
 [118548]=5,
 [118549]=5,
 [118550]=5,
 [118551]=5,
 [118552]=5,
 [118553]=5,
 [118554]=5,
 [118555]=5,
 [118556]=5,
 [118557]=5,
 [118558]=5,
 [118559]=5,
 [118560]=5,
 [118561]=5,
 [118562]=5,
 [118563]=5,
 [118564]=5,
 [118565]=5,
 [118566]=5,
 [118567]=5,
 [118568]=5,
 [118569]=5,
 [118570]=5,
 [118571]=5,
 [118572]=5,
 [118573]=5,
 [118576]=5,
 [118577]=5,
 [118578]=5,
 [118579]=5,
 [118580]=5,
 [118581]=5,
 [118582]=5,
 [118583]=5,
 [118584]=5,
 [118585]=5,
 [118586]=5,
 [118587]=5,
 [118588]=5,
 [118589]=5,
 [118590]=5,
 [118591]=5,
 [118592]=5,
 [118593]=5,
 [118594]=5,
 [118595]=5,
 [118596]=5,
 [118597]=5,
 [118598]=5,
 [119143]=5,
 [119144]=5,
 [119145]=5,
 [119163]=5,
 [119164]=5,
 [119165]=5,
 [119166]=5,
 [119167]=5,
 [119168]=5,
 [119169]=5,
 [119170]=5,
 [119173]=5,
 [119174]=5,
 [119175]=5,
 [119176]=5,
 [119177]=5,
 [119178]=5,
 [119179]=5,
 [119210]=5,
 [119211]=5,
 [119212]=5,
 [119213]=5,
 [119362]=5,
 [119363]=5,
 [119364]=5,
 [121344]=5,
 [121345]=5,
 [121346]=5,
 [121347]=5,
 [121348]=5,
 [121349]=5,
 [121350]=5,
 [121351]=5,
 [121352]=5,
 [121353]=5,
 [121354]=5,
 [121355]=5,
 [121356]=5,
 [121357]=5,
 [121358]=5,
 [121359]=5,
 [121360]=5,
 [121361]=5,
 [121362]=5,
 [121363]=5,
 [121364]=5,
 [121365]=5,
 [121366]=5,
 [121367]=5,
 [121368]=5,
 [121369]=5,
 [121370]=5,
 [121371]=5,
 [121372]=5,
 [121373]=5,
 [121374]=5,
 [121375]=5,
 [121376]=5,
 [121377]=5,
 [121378]=5,
 [121379]=5,
 [121380]=5,
 [121381]=5,
 [121382]=5,
 [121383]=5,
 [121384]=5,
 [121385]=5,
 [121386]=5,
 [121387]=5,
 [121388]=5,
 [121389]=5,
 [121390]=5,
 [121391]=5,
 [121392]=5,
 [121393]=5,
 [121394]=5,
 [121395]=5,
 [121396]=5,
 [121397]=5,
 [121398]=5,
 [121403]=5,
 [121404]=5,
 [121405]=5,
 [121406]=5,
 [121407]=5,
 [121408]=5,
 [121409]=5,
 [121410]=5,
 [121411]=5,
 [121412]=5,
 [121413]=5,
 [121414]=5,
 [121415]=5,
 [121416]=5,
 [121417]=5,
 [121418]=5,
 [121419]=5,
 [121420]=5,
 [121421]=5,
 [121422]=5,
 [121423]=5,
 [121424]=5,
 [121425]=5,
 [121426]=5,
 [121427]=5,
 [121428]=5,
 [121429]=5,
 [121430]=5,
 [121431]=5,
 [121432]=5,
 [121433]=5,
 [121434]=5,
 [121435]=5,
 [121436]=5,
 [121437]=5,
 [121438]=5,
 [121439]=5,
 [121440]=5,
 [121441]=5,
 [121442]=5,
 [121443]=5,
 [121444]=5,
 [121445]=5,
 [121446]=5,
 [121447]=5,
 [121448]=5,
 [121449]=5,
 [121450]=5,
 [121451]=5,
 [121452]=5,
 [121461]=5,
 [121476]=5,
 [121499]=5,
 [121500]=5,
 [121501]=5,
 [121502]=5,
 [121503]=5,
 [121505]=5,
 [121506]=5,
 [121507]=5,
 [121508]=5,
 [121509]=5,
 [121510]=5,
 [121511]=5,
 [121512]=5,
 [121513]=5,
 [121514]=5,
 [121515]=5,
 [121516]=5,
 [121517]=5,
 [121518]=5,
 [121519]=5,
 [122880]=5,
 [122881]=5,
 [122882]=5,
 [122883]=5,
 [122884]=5,
 [122885]=5,
 [122886]=5,
 [122888]=5,
 [122889]=5,
 [122890]=5,
 [122891]=5,
 [122892]=5,
 [122893]=5,
 [122894]=5,
 [122895]=5,
 [122896]=5,
 [122897]=5,
 [122898]=5,
 [122899]=5,
 [122900]=5,
 [122901]=5,
 [122902]=5,
 [122903]=5,
 [122904]=5,
 [122907]=5,
 [122908]=5,
 [122909]=5,
 [122910]=5,
 [122911]=5,
 [122912]=5,
 [122913]=5,
 [122915]=5,
 [122916]=5,
 [122918]=5,
 [122919]=5,
 [122920]=5,
 [122921]=5,
 [122922]=5,
 [123184]=5,
 [123185]=5,
 [123186]=5,
 [123187]=5,
 [123188]=5,
 [123189]=5,
 [123190]=5,
 [123566]=5,
 [123628]=5,
 [123629]=5,
 [123630]=5,
 [123631]=5,
 [125136]=5,
 [125137]=5,
 [125138]=5,
 [125139]=5,
 [125140]=5,
 [125141]=5,
 [125142]=5,
 [125184]=2,
 [125185]=2,
 [125186]=2,
 [125187]=2,
 [125188]=2,
 [125189]=2,
 [125190]=2,
 [125191]=2,
 [125192]=2,
 [125193]=2,
 [125194]=2,
 [125195]=2,
 [125196]=2,
 [125197]=2,
 [125198]=2,
 [125199]=2,
 [125200]=2,
 [125201]=2,
 [125202]=2,
 [125203]=2,
 [125204]=2,
 [125205]=2,
 [125206]=2,
 [125207]=2,
 [125208]=2,
 [125209]=2,
 [125210]=2,
 [125211]=2,
 [125212]=2,
 [125213]=2,
 [125214]=2,
 [125215]=2,
 [125216]=2,
 [125217]=2,
 [125218]=2,
 [125219]=2,
 [125220]=2,
 [125221]=2,
 [125222]=2,
 [125223]=2,
 [125224]=2,
 [125225]=2,
 [125226]=2,
 [125227]=2,
 [125228]=2,
 [125229]=2,
 [125230]=2,
 [125231]=2,
 [125232]=2,
 [125233]=2,
 [125234]=2,
 [125235]=2,
 [125236]=2,
 [125237]=2,
 [125238]=2,
 [125239]=2,
 [125240]=2,
 [125241]=2,
 [125242]=2,
 [125243]=2,
 [125244]=2,
 [125245]=2,
 [125246]=2,
 [125247]=2,
 [125248]=2,
 [125249]=2,
 [125250]=2,
 [125251]=2,
 [125252]=5,
 [125253]=5,
 [125254]=5,
 [125255]=5,
 [125256]=5,
 [125257]=5,
 [125258]=5,
 [1042752]=5,
}
characters.indicgroups={
 ["above_mark"]={
  [2304]=true,
  [2305]=true,
  [2306]=true,
  [2362]=true,
  [2373]=true,
  [2374]=true,
  [2375]=true,
  [2376]=true,
  [2385]=true,
  [2387]=true,
  [2388]=true,
  [2389]=true,
  [2631]=true,
  [2632]=true,
  [2635]=true,
  [2636]=true,
  [2690]=true,
  [2757]=true,
  [2759]=true,
  [2760]=true,
  [2879]=true,
  [3008]=true,
  [3021]=true,
  [3134]=true,
  [3135]=true,
  [3136]=true,
  [3142]=true,
  [3143]=true,
  [3146]=true,
  [3147]=true,
  [3148]=true,
  [3149]=true,
  [3263]=true,
  [3270]=true,
  [3406]=true,
  [4141]=true,
  [4142]=true,
  [4146]=true,
  [4147]=true,
  [4148]=true,
  [4149]=true,
  [4150]=true,
  [4154]=true,
  [4209]=true,
  [4210]=true,
  [4211]=true,
  [4212]=true,
  [4229]=true,
  [4230]=true,
  [4253]=true,
  [43232]=true,
  [43233]=true,
  [43234]=true,
  [43235]=true,
  [43236]=true,
  [43237]=true,
  [43238]=true,
  [43239]=true,
  [43240]=true,
  [43241]=true,
  [43242]=true,
  [43243]=true,
  [43244]=true,
  [43245]=true,
  [43246]=true,
  [43247]=true,
  [43248]=true,
  [43249]=true,
  [43493]=true,
  [43644]=true,
 },
 ["after_half"]={},
 ["after_main"]={
  [2864]=true,
  [2879]=true,
  [2902]=true,
  [3376]=true,
  [5901]=true,
 },
 ["after_postscript"]={
  [2433]=true,
  [2494]=true,
  [2496]=true,
  [2519]=true,
  [2561]=true,
  [2562]=true,
  [2622]=true,
  [2624]=true,
  [2625]=true,
  [2626]=true,
  [2672]=true,
  [2673]=true,
  [2735]=true,
  [2750]=true,
  [2752]=true,
  [2753]=true,
  [2754]=true,
  [2755]=true,
  [2756]=true,
  [2761]=true,
  [2763]=true,
  [2764]=true,
  [2786]=true,
  [2787]=true,
  [2878]=true,
  [2880]=true,
  [2903]=true,
  [2992]=true,
  [3006]=true,
  [3007]=true,
  [3009]=true,
  [3010]=true,
  [3031]=true,
  [3120]=true,
  [3248]=true,
  [3390]=true,
  [3391]=true,
  [3392]=true,
  [3393]=true,
  [3394]=true,
  [3395]=true,
  [3415]=true,
 },
 ["after_subscript"]={
  [2366]=true,
  [2368]=true,
  [2369]=true,
  [2370]=true,
  [2371]=true,
  [2372]=true,
  [2373]=true,
  [2374]=true,
  [2375]=true,
  [2376]=true,
  [2377]=true,
  [2378]=true,
  [2379]=true,
  [2380]=true,
  [2402]=true,
  [2403]=true,
  [2480]=true,
  [2497]=true,
  [2498]=true,
  [2499]=true,
  [2500]=true,
  [2530]=true,
  [2531]=true,
  [2544]=true,
  [2631]=true,
  [2632]=true,
  [2635]=true,
  [2636]=true,
  [2757]=true,
  [2759]=true,
  [2760]=true,
  [2881]=true,
  [2882]=true,
  [2883]=true,
  [3008]=true,
  [3139]=true,
  [3140]=true,
  [3267]=true,
  [3268]=true,
  [3285]=true,
  [3286]=true,
 },
 ["anudatta"]={
  [2386]=true,
 },
 ["before_half"]={
  [2367]=true,
  [2382]=true,
  [2495]=true,
  [2503]=true,
  [2504]=true,
  [2623]=true,
  [2751]=true,
  [2887]=true,
 },
 ["before_main"]={
  [3014]=true,
  [3015]=true,
  [3016]=true,
  [3398]=true,
  [3399]=true,
  [3400]=true,
 },
 ["before_postscript"]={
  [2352]=true,
  [2736]=true,
 },
 ["before_subscript"]={
  [2608]=true,
  [2817]=true,
  [3134]=true,
  [3135]=true,
  [3136]=true,
  [3137]=true,
  [3138]=true,
  [3142]=true,
  [3143]=true,
  [3146]=true,
  [3147]=true,
  [3148]=true,
  [3157]=true,
  [3158]=true,
  [3262]=true,
  [3263]=true,
  [3265]=true,
  [3266]=true,
  [3270]=true,
  [3276]=true,
  [3298]=true,
  [3299]=true,
 },
 ["below_mark"]={
  [2364]=true,
  [2369]=true,
  [2370]=true,
  [2371]=true,
  [2372]=true,
  [2381]=true,
  [2386]=true,
  [2390]=true,
  [2391]=true,
  [2402]=true,
  [2403]=true,
  [2492]=true,
  [2497]=true,
  [2498]=true,
  [2499]=true,
  [2500]=true,
  [2509]=true,
  [2620]=true,
  [2625]=true,
  [2626]=true,
  [2637]=true,
  [2748]=true,
  [2753]=true,
  [2754]=true,
  [2755]=true,
  [2756]=true,
  [2765]=true,
  [2876]=true,
  [2881]=true,
  [2882]=true,
  [2883]=true,
  [2884]=true,
  [2893]=true,
  [2914]=true,
  [2915]=true,
  [3009]=true,
  [3010]=true,
  [3132]=true,
  [3170]=true,
  [3171]=true,
  [3260]=true,
  [3286]=true,
  [3298]=true,
  [3299]=true,
  [3426]=true,
  [3427]=true,
  [4143]=true,
  [4144]=true,
  [4151]=true,
  [4153]=true,
  [4157]=true,
  [4158]=true,
  [4184]=true,
  [4185]=true,
  [4190]=true,
  [4191]=true,
  [4192]=true,
  [4226]=true,
  [4237]=true,
 },
 ["consonant"]={
  [2325]=true,
  [2326]=true,
  [2327]=true,
  [2328]=true,
  [2329]=true,
  [2330]=true,
  [2331]=true,
  [2332]=true,
  [2333]=true,
  [2334]=true,
  [2335]=true,
  [2336]=true,
  [2337]=true,
  [2338]=true,
  [2339]=true,
  [2340]=true,
  [2341]=true,
  [2342]=true,
  [2343]=true,
  [2344]=true,
  [2345]=true,
  [2346]=true,
  [2347]=true,
  [2348]=true,
  [2349]=true,
  [2350]=true,
  [2351]=true,
  [2352]=true,
  [2353]=true,
  [2354]=true,
  [2355]=true,
  [2356]=true,
  [2357]=true,
  [2358]=true,
  [2359]=true,
  [2360]=true,
  [2361]=true,
  [2392]=true,
  [2393]=true,
  [2394]=true,
  [2395]=true,
  [2396]=true,
  [2397]=true,
  [2398]=true,
  [2399]=true,
  [2424]=true,
  [2425]=true,
  [2426]=true,
  [2453]=true,
  [2454]=true,
  [2455]=true,
  [2456]=true,
  [2457]=true,
  [2458]=true,
  [2459]=true,
  [2460]=true,
  [2461]=true,
  [2462]=true,
  [2463]=true,
  [2464]=true,
  [2465]=true,
  [2466]=true,
  [2467]=true,
  [2468]=true,
  [2469]=true,
  [2470]=true,
  [2471]=true,
  [2472]=true,
  [2474]=true,
  [2475]=true,
  [2476]=true,
  [2477]=true,
  [2478]=true,
  [2479]=true,
  [2480]=true,
  [2482]=true,
  [2486]=true,
  [2487]=true,
  [2488]=true,
  [2489]=true,
  [2510]=true,
  [2524]=true,
  [2525]=true,
  [2527]=true,
  [2581]=true,
  [2582]=true,
  [2583]=true,
  [2584]=true,
  [2585]=true,
  [2586]=true,
  [2587]=true,
  [2588]=true,
  [2589]=true,
  [2590]=true,
  [2591]=true,
  [2592]=true,
  [2593]=true,
  [2594]=true,
  [2595]=true,
  [2596]=true,
  [2597]=true,
  [2598]=true,
  [2599]=true,
  [2600]=true,
  [2602]=true,
  [2603]=true,
  [2604]=true,
  [2605]=true,
  [2606]=true,
  [2607]=true,
  [2608]=true,
  [2610]=true,
  [2611]=true,
  [2613]=true,
  [2614]=true,
  [2616]=true,
  [2617]=true,
  [2649]=true,
  [2650]=true,
  [2651]=true,
  [2652]=true,
  [2654]=true,
  [2709]=true,
  [2710]=true,
  [2711]=true,
  [2712]=true,
  [2713]=true,
  [2714]=true,
  [2715]=true,
  [2716]=true,
  [2717]=true,
  [2718]=true,
  [2719]=true,
  [2720]=true,
  [2721]=true,
  [2722]=true,
  [2723]=true,
  [2724]=true,
  [2725]=true,
  [2726]=true,
  [2727]=true,
  [2728]=true,
  [2730]=true,
  [2731]=true,
  [2732]=true,
  [2733]=true,
  [2734]=true,
  [2735]=true,
  [2736]=true,
  [2738]=true,
  [2739]=true,
  [2741]=true,
  [2742]=true,
  [2743]=true,
  [2744]=true,
  [2745]=true,
  [2837]=true,
  [2838]=true,
  [2839]=true,
  [2840]=true,
  [2841]=true,
  [2842]=true,
  [2843]=true,
  [2844]=true,
  [2845]=true,
  [2846]=true,
  [2847]=true,
  [2848]=true,
  [2849]=true,
  [2850]=true,
  [2851]=true,
  [2852]=true,
  [2853]=true,
  [2854]=true,
  [2855]=true,
  [2856]=true,
  [2858]=true,
  [2859]=true,
  [2860]=true,
  [2861]=true,
  [2862]=true,
  [2863]=true,
  [2864]=true,
  [2866]=true,
  [2867]=true,
  [2869]=true,
  [2870]=true,
  [2871]=true,
  [2872]=true,
  [2873]=true,
  [2908]=true,
  [2909]=true,
  [2929]=true,
  [2965]=true,
  [2969]=true,
  [2970]=true,
  [2972]=true,
  [2974]=true,
  [2975]=true,
  [2979]=true,
  [2980]=true,
  [2984]=true,
  [2985]=true,
  [2986]=true,
  [2990]=true,
  [2991]=true,
  [2992]=true,
  [2993]=true,
  [2994]=true,
  [2995]=true,
  [2996]=true,
  [2997]=true,
  [2998]=true,
  [2999]=true,
  [3000]=true,
  [3001]=true,
  [3093]=true,
  [3094]=true,
  [3095]=true,
  [3096]=true,
  [3097]=true,
  [3098]=true,
  [3099]=true,
  [3100]=true,
  [3101]=true,
  [3102]=true,
  [3103]=true,
  [3104]=true,
  [3105]=true,
  [3106]=true,
  [3107]=true,
  [3108]=true,
  [3109]=true,
  [3110]=true,
  [3111]=true,
  [3112]=true,
  [3114]=true,
  [3115]=true,
  [3116]=true,
  [3117]=true,
  [3118]=true,
  [3119]=true,
  [3120]=true,
  [3121]=true,
  [3122]=true,
  [3123]=true,
  [3124]=true,
  [3125]=true,
  [3126]=true,
  [3127]=true,
  [3128]=true,
  [3129]=true,
  [3133]=true,
  [3221]=true,
  [3222]=true,
  [3223]=true,
  [3224]=true,
  [3225]=true,
  [3226]=true,
  [3227]=true,
  [3228]=true,
  [3229]=true,
  [3230]=true,
  [3231]=true,
  [3232]=true,
  [3233]=true,
  [3234]=true,
  [3235]=true,
  [3236]=true,
  [3237]=true,
  [3238]=true,
  [3239]=true,
  [3240]=true,
  [3242]=true,
  [3243]=true,
  [3244]=true,
  [3245]=true,
  [3246]=true,
  [3247]=true,
  [3248]=true,
  [3249]=true,
  [3250]=true,
  [3251]=true,
  [3253]=true,
  [3254]=true,
  [3255]=true,
  [3256]=true,
  [3257]=true,
  [3294]=true,
  [3349]=true,
  [3350]=true,
  [3351]=true,
  [3352]=true,
  [3353]=true,
  [3354]=true,
  [3355]=true,
  [3356]=true,
  [3357]=true,
  [3358]=true,
  [3359]=true,
  [3360]=true,
  [3361]=true,
  [3362]=true,
  [3363]=true,
  [3364]=true,
  [3365]=true,
  [3366]=true,
  [3367]=true,
  [3368]=true,
  [3369]=true,
  [3370]=true,
  [3371]=true,
  [3372]=true,
  [3373]=true,
  [3374]=true,
  [3375]=true,
  [3376]=true,
  [3377]=true,
  [3378]=true,
  [3379]=true,
  [3380]=true,
  [3381]=true,
  [3382]=true,
  [3383]=true,
  [3384]=true,
  [3385]=true,
  [3386]=true,
  [4096]=true,
  [4097]=true,
  [4098]=true,
  [4099]=true,
  [4100]=true,
  [4101]=true,
  [4102]=true,
  [4103]=true,
  [4104]=true,
  [4105]=true,
  [4106]=true,
  [4107]=true,
  [4108]=true,
  [4109]=true,
  [4110]=true,
  [4111]=true,
  [4112]=true,
  [4113]=true,
  [4114]=true,
  [4115]=true,
  [4116]=true,
  [4117]=true,
  [4118]=true,
  [4119]=true,
  [4120]=true,
  [4121]=true,
  [4122]=true,
  [4123]=true,
  [4124]=true,
  [4125]=true,
  [4126]=true,
  [4127]=true,
  [4128]=true,
  [4155]=true,
  [4156]=true,
  [4157]=true,
  [4158]=true,
  [4159]=true,
  [4176]=true,
  [4177]=true,
  [4186]=true,
  [4187]=true,
  [4188]=true,
  [4189]=true,
  [4190]=true,
  [4191]=true,
  [4192]=true,
  [4193]=true,
  [4197]=true,
  [4198]=true,
  [4206]=true,
  [4207]=true,
  [4208]=true,
  [4213]=true,
  [4214]=true,
  [4215]=true,
  [4216]=true,
  [4217]=true,
  [4218]=true,
  [4219]=true,
  [4220]=true,
  [4221]=true,
  [4222]=true,
  [4223]=true,
  [4224]=true,
  [4225]=true,
  [4226]=true,
  [4238]=true,
  [5901]=true,
  [43488]=true,
  [43489]=true,
  [43490]=true,
  [43491]=true,
  [43492]=true,
  [43495]=true,
  [43496]=true,
  [43497]=true,
  [43498]=true,
  [43499]=true,
  [43500]=true,
  [43501]=true,
  [43502]=true,
  [43503]=true,
  [43514]=true,
  [43515]=true,
  [43516]=true,
  [43517]=true,
  [43518]=true,
  [43616]=true,
  [43617]=true,
  [43618]=true,
  [43619]=true,
  [43620]=true,
  [43621]=true,
  [43622]=true,
  [43623]=true,
  [43624]=true,
  [43625]=true,
  [43626]=true,
  [43628]=true,
  [43629]=true,
  [43630]=true,
  [43631]=true,
  [43633]=true,
  [43634]=true,
  [43635]=true,
  [43636]=true,
  [43637]=true,
  [43638]=true,
  [43642]=true,
  [43646]=true,
  [43647]=true,
 },
 ["dependent_vowel"]={
  [2362]=true,
  [2363]=true,
  [2366]=true,
  [2367]=true,
  [2368]=true,
  [2369]=true,
  [2370]=true,
  [2371]=true,
  [2372]=true,
  [2373]=true,
  [2374]=true,
  [2375]=true,
  [2376]=true,
  [2377]=true,
  [2378]=true,
  [2379]=true,
  [2380]=true,
  [2382]=true,
  [2383]=true,
  [2389]=true,
  [2390]=true,
  [2391]=true,
  [2402]=true,
  [2403]=true,
  [2494]=true,
  [2495]=true,
  [2497]=true,
  [2498]=true,
  [2499]=true,
  [2500]=true,
  [2503]=true,
  [2504]=true,
  [2507]=true,
  [2508]=true,
  [2622]=true,
  [2623]=true,
  [2624]=true,
  [2625]=true,
  [2626]=true,
  [2631]=true,
  [2632]=true,
  [2635]=true,
  [2636]=true,
  [2750]=true,
  [2751]=true,
  [2752]=true,
  [2753]=true,
  [2754]=true,
  [2755]=true,
  [2756]=true,
  [2757]=true,
  [2759]=true,
  [2760]=true,
  [2761]=true,
  [2763]=true,
  [2764]=true,
  [2878]=true,
  [2879]=true,
  [2880]=true,
  [2881]=true,
  [2882]=true,
  [2883]=true,
  [2884]=true,
  [2887]=true,
  [2888]=true,
  [2891]=true,
  [2892]=true,
  [2914]=true,
  [2915]=true,
  [3006]=true,
  [3007]=true,
  [3008]=true,
  [3009]=true,
  [3010]=true,
  [3014]=true,
  [3015]=true,
  [3016]=true,
  [3018]=true,
  [3019]=true,
  [3020]=true,
  [3134]=true,
  [3135]=true,
  [3136]=true,
  [3137]=true,
  [3138]=true,
  [3139]=true,
  [3140]=true,
  [3142]=true,
  [3143]=true,
  [3144]=true,
  [3146]=true,
  [3147]=true,
  [3148]=true,
  [3170]=true,
  [3171]=true,
  [3262]=true,
  [3263]=true,
  [3264]=true,
  [3265]=true,
  [3266]=true,
  [3267]=true,
  [3268]=true,
  [3270]=true,
  [3271]=true,
  [3272]=true,
  [3274]=true,
  [3275]=true,
  [3276]=true,
  [3285]=true,
  [3286]=true,
  [3298]=true,
  [3299]=true,
  [3390]=true,
  [3391]=true,
  [3392]=true,
  [3393]=true,
  [3394]=true,
  [3395]=true,
  [3396]=true,
  [3398]=true,
  [3399]=true,
  [3400]=true,
  [3402]=true,
  [3403]=true,
  [3404]=true,
  [3415]=true,
  [3426]=true,
  [3427]=true,
  [4139]=true,
  [4140]=true,
  [4141]=true,
  [4142]=true,
  [4143]=true,
  [4144]=true,
  [4145]=true,
  [4146]=true,
  [4147]=true,
  [4148]=true,
  [4149]=true,
  [4182]=true,
  [4183]=true,
  [4184]=true,
  [4185]=true,
  [4194]=true,
  [4199]=true,
  [4200]=true,
  [4209]=true,
  [4210]=true,
  [4211]=true,
  [4212]=true,
  [4227]=true,
  [4228]=true,
  [4229]=true,
  [4230]=true,
  [4252]=true,
  [4253]=true,
  [43493]=true,
 },
 ["halant"]={
  [2381]=true,
  [2509]=true,
  [2637]=true,
  [2765]=true,
  [2893]=true,
  [3021]=true,
  [3149]=true,
  [3277]=true,
  [3405]=true,
 },
 ["independent_vowel"]={
  [2308]=true,
  [2309]=true,
  [2310]=true,
  [2311]=true,
  [2312]=true,
  [2313]=true,
  [2314]=true,
  [2315]=true,
  [2316]=true,
  [2317]=true,
  [2318]=true,
  [2319]=true,
  [2320]=true,
  [2321]=true,
  [2322]=true,
  [2323]=true,
  [2324]=true,
  [2400]=true,
  [2401]=true,
  [2418]=true,
  [2419]=true,
  [2420]=true,
  [2421]=true,
  [2422]=true,
  [2423]=true,
  [2437]=true,
  [2438]=true,
  [2439]=true,
  [2440]=true,
  [2441]=true,
  [2442]=true,
  [2443]=true,
  [2444]=true,
  [2447]=true,
  [2448]=true,
  [2451]=true,
  [2452]=true,
  [2528]=true,
  [2529]=true,
  [2530]=true,
  [2531]=true,
  [2565]=true,
  [2566]=true,
  [2567]=true,
  [2568]=true,
  [2569]=true,
  [2570]=true,
  [2575]=true,
  [2576]=true,
  [2579]=true,
  [2580]=true,
  [2693]=true,
  [2694]=true,
  [2695]=true,
  [2696]=true,
  [2697]=true,
  [2698]=true,
  [2699]=true,
  [2700]=true,
  [2701]=true,
  [2703]=true,
  [2704]=true,
  [2705]=true,
  [2707]=true,
  [2708]=true,
  [2784]=true,
  [2785]=true,
  [2786]=true,
  [2787]=true,
  [2821]=true,
  [2822]=true,
  [2823]=true,
  [2824]=true,
  [2825]=true,
  [2826]=true,
  [2827]=true,
  [2828]=true,
  [2831]=true,
  [2832]=true,
  [2835]=true,
  [2836]=true,
  [2912]=true,
  [2913]=true,
  [2949]=true,
  [2950]=true,
  [2951]=true,
  [2952]=true,
  [2953]=true,
  [2954]=true,
  [2958]=true,
  [2959]=true,
  [2960]=true,
  [2962]=true,
  [2963]=true,
  [2964]=true,
  [3077]=true,
  [3078]=true,
  [3079]=true,
  [3080]=true,
  [3081]=true,
  [3082]=true,
  [3083]=true,
  [3084]=true,
  [3086]=true,
  [3087]=true,
  [3088]=true,
  [3090]=true,
  [3091]=true,
  [3092]=true,
  [3165]=true,
  [3168]=true,
  [3169]=true,
  [3205]=true,
  [3206]=true,
  [3207]=true,
  [3208]=true,
  [3209]=true,
  [3210]=true,
  [3211]=true,
  [3212]=true,
  [3214]=true,
  [3215]=true,
  [3216]=true,
  [3218]=true,
  [3219]=true,
  [3220]=true,
  [3293]=true,
  [3296]=true,
  [3297]=true,
  [3333]=true,
  [3334]=true,
  [3335]=true,
  [3336]=true,
  [3337]=true,
  [3338]=true,
  [3339]=true,
  [3340]=true,
  [3342]=true,
  [3343]=true,
  [3344]=true,
  [3346]=true,
  [3347]=true,
  [3348]=true,
  [3423]=true,
  [3424]=true,
  [3425]=true,
  [4129]=true,
  [4130]=true,
  [4131]=true,
  [4132]=true,
  [4133]=true,
  [4134]=true,
  [4135]=true,
  [4136]=true,
  [4137]=true,
  [4138]=true,
  [4178]=true,
  [4179]=true,
  [4180]=true,
  [4181]=true,
 },
 ["nukta"]={
  [2364]=true,
  [2492]=true,
  [2620]=true,
  [2748]=true,
  [2876]=true,
  [3132]=true,
  [3260]=true,
 },
 ["post_mark"]={
  [2307]=true,
  [2363]=true,
  [2366]=true,
  [2368]=true,
  [2377]=true,
  [2378]=true,
  [2379]=true,
  [2380]=true,
  [2383]=true,
  [2494]=true,
  [2496]=true,
  [2622]=true,
  [2624]=true,
  [2750]=true,
  [2752]=true,
  [2761]=true,
  [2763]=true,
  [2764]=true,
  [2878]=true,
  [2880]=true,
  [3006]=true,
  [3007]=true,
  [3137]=true,
  [3138]=true,
  [3139]=true,
  [3140]=true,
  [3262]=true,
  [3265]=true,
  [3266]=true,
  [3267]=true,
  [3268]=true,
  [3276]=true,
  [3285]=true,
  [3390]=true,
  [3391]=true,
  [3392]=true,
  [3393]=true,
  [3394]=true,
  [3395]=true,
  [3396]=true,
  [3415]=true,
  [4139]=true,
  [4140]=true,
  [4152]=true,
  [4155]=true,
  [4182]=true,
  [4183]=true,
  [4194]=true,
  [4195]=true,
  [4196]=true,
  [4199]=true,
  [4200]=true,
  [4201]=true,
  [4202]=true,
  [4203]=true,
  [4204]=true,
  [4205]=true,
  [4227]=true,
  [4231]=true,
  [4232]=true,
  [4233]=true,
  [4234]=true,
  [4235]=true,
  [4236]=true,
  [4239]=true,
  [4250]=true,
  [4251]=true,
  [4252]=true,
  [43643]=true,
  [43645]=true,
 },
 ["pre_mark"]={
  [2367]=true,
  [2382]=true,
  [2495]=true,
  [2503]=true,
  [2504]=true,
  [2623]=true,
  [2751]=true,
  [2887]=true,
  [3014]=true,
  [3015]=true,
  [3016]=true,
  [3398]=true,
  [3399]=true,
  [3400]=true,
  [4145]=true,
  [4228]=true,
 },
 ["ra"]={
  [2352]=true,
  [2480]=true,
  [2544]=true,
  [2608]=true,
  [2736]=true,
  [2864]=true,
  [2992]=true,
  [3120]=true,
  [3248]=true,
  [3376]=true,
  [5901]=true,
 },
 ["stress_tone_mark"]={
  [2385]=true,
  [2386]=true,
  [2387]=true,
  [2388]=true,
  [4151]=true,
  [4195]=true,
  [4196]=true,
  [4201]=true,
  [4202]=true,
  [4203]=true,
  [4204]=true,
  [4205]=true,
  [4231]=true,
  [4232]=true,
  [4233]=true,
  [4234]=true,
  [4235]=true,
  [4236]=true,
  [4237]=true,
  [4239]=true,
  [4250]=true,
  [4251]=true,
  [43643]=true,
  [43644]=true,
  [43645]=true,
 },
 ["twopart_mark"]={
  [2507]={ 2503,2494 },
  [2508]={ 2503,2519 },
  [2888]={ 2887,2902 },
  [2891]={ 2887,2878 },
  [2892]={ 2887,2903 },
  [3018]={ 3014,3006 },
  [3019]={ 3015,3006 },
  [3020]={ 3014,3031 },
  [3144]={ 3142,3158 },
  [3264]={ 3263,3285 },
  [3271]={ 3270,3285 },
  [3272]={ 3270,3286 },
  [3274]={ 3270,3266 },
  [3275]={ 3274,3285 },
  [3402]={ 3398,3390 },
  [3403]={ 3399,3390 },
  [3404]={ 3398,3415 },
 },
 ["vowel_modifier"]={
  [2304]=true,
  [2305]=true,
  [2306]=true,
  [2307]=true,
  [2433]=true,
  [3330]=true,
  [3331]=true,
  [4150]=true,
  [4152]=true,
  [4153]=true,
  [4154]=true,
  [43232]=true,
  [43233]=true,
  [43234]=true,
  [43235]=true,
  [43236]=true,
  [43237]=true,
  [43238]=true,
  [43239]=true,
  [43240]=true,
  [43241]=true,
  [43242]=true,
  [43243]=true,
  [43244]=true,
  [43245]=true,
  [43246]=true,
  [43247]=true,
  [43249]=true,
 },
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “basics-chr”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ini” 5343de60613adb24cdd7a8d2ee1d153c] ---

if not modules then modules={} end modules ['font-ini']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local allocate=utilities.storage.allocate
local sortedhash=table.sortedhash
fonts=fonts or {}
local fonts=fonts
local identifiers=allocate()
fonts.hashes=fonts.hashes  or { identifiers=identifiers }
fonts.tables=fonts.tables  or {}
fonts.helpers=fonts.helpers or {}
fonts.tracers=fonts.tracers or {} 
fonts.specifiers=fonts.specifiers or {} 
fonts.analyzers={} 
fonts.readers={}
fonts.definers={ methods={} }
fonts.loggers={ register=function() end }
if context then
 font.originaleach=font.each
 function font.each()
  return sortedhash(identifiers)
 end
 fontloader=nil
end
fonts.privateoffsets={
 textbase=0xF0000,
 textextrabase=0xFD000,
 mathextrabase=0xFE000,
 mathbase=0xFF000,
 keepnames=false,
}
if node and not tex.getfontoffamily then
 tex.getfontoffamily=node.family_font 
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ini”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-mis” 17e967c9ec4d001deefd43ddf25e98f7] ---

if not modules then modules={} end modules ['luatex-font-mis']={
 version=1.001,
 comment="companion to luatex-*.tex",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
local currentfont=font.current
local hashes=fonts.hashes
local identifiers=hashes.identifiers or {}
local marks=hashes.marks    or {}
hashes.identifiers=identifiers
hashes.marks=marks
table.setmetatableindex(marks,function(t,k)
 if k==true then
  return marks[currentfont()]
 else
  local resources=identifiers[k].resources or {}
  local marks=resources.marks or {}
  t[k]=marks
  return marks
 end
end)
function font.each()
 return table.sortedhash(fonts.hashes.identifiers)
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-mis”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-con” 724e5dd14aec2d4d189f8619898004cf] ---

if not modules then modules={} end modules ['font-con']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,tostring,tonumber,rawget=next,tostring,tonumber,rawget
local format,match,lower,gsub,find=string.format,string.match,string.lower,string.gsub,string.find
local sort,insert,concat=table.sort,table.insert,table.concat
local sortedkeys,sortedhash,serialize,fastcopy=table.sortedkeys,table.sortedhash,table.serialize,table.fastcopy
local derivetable=table.derive
local ioflush=io.flush
local round=math.round
local setmetatable,getmetatable,rawget,rawset=setmetatable,getmetatable,rawget,rawset
local trace_defining=false  trackers.register("fonts.defining",function(v) trace_defining=v end)
local trace_scaling=false  trackers.register("fonts.scaling",function(v) trace_scaling=v end)
local report_defining=logs.reporter("fonts","defining")
local fonts=fonts
local constructors=fonts.constructors or {}
fonts.constructors=constructors
local handlers=fonts.handlers or {} 
fonts.handlers=handlers
local allocate=utilities.storage.allocate
local setmetatableindex=table.setmetatableindex
constructors.dontembed=allocate()
constructors.namemode="fullpath" 
constructors.version=1.01
constructors.cache=containers.define("fonts","constructors",constructors.version,false)
constructors.privateoffset=fonts.privateoffsets.textbase or 0xF0000
constructors.cacheintex=true 
constructors.addtounicode=true
constructors.fixprotrusion=true
local designsizes=allocate()
constructors.designsizes=designsizes
local loadedfonts=allocate()
constructors.loadedfonts=loadedfonts
local factors={
 pt=65536.0,
 bp=65781.8,
}
function constructors.setfactor(f)
 constructors.factor=factors[f or 'pt'] or factors.pt
end
constructors.setfactor()
function constructors.scaled(scaledpoints,designsize) 
 if scaledpoints<0 then
  local factor=constructors.factor
  if designsize then
   if designsize>factor then 
    return (- scaledpoints/1000)*designsize 
   else
    return (- scaledpoints/1000)*designsize*factor
   end
  else
   return (- scaledpoints/1000)*10*factor
  end
 else
  return scaledpoints
 end
end
function constructors.getprivate(tfmdata)
 local properties=tfmdata.properties
 local private=properties.private
 properties.private=private+1
 return private
end
function constructors.setmathparameter(tfmdata,name,value)
 local m=tfmdata.mathparameters
 local c=tfmdata.MathConstants
 if m then
  m[name]=value
 end
 if c and c~=m then
  c[name]=value
 end
end
function constructors.getmathparameter(tfmdata,name)
 local p=tfmdata.mathparameters or tfmdata.MathConstants
 if p then
  return p[name]
 end
end
function constructors.cleanuptable(tfmdata)
end
function constructors.calculatescale(tfmdata,scaledpoints)
 local parameters=tfmdata.parameters
 if scaledpoints<0 then
  scaledpoints=(- scaledpoints/1000)*(tfmdata.designsize or parameters.designsize) 
 end
 return scaledpoints,scaledpoints/(parameters.units or 1000) 
end
local unscaled={
 ScriptPercentScaleDown=true,
 ScriptScriptPercentScaleDown=true,
 RadicalDegreeBottomRaisePercent=true,
 NoLimitSupFactor=true,
 NoLimitSubFactor=true,
}
function constructors.assignmathparameters(target,original)
 local mathparameters=original.mathparameters
 if mathparameters and next(mathparameters) then
  local targetparameters=target.parameters
  local targetproperties=target.properties
  local targetmathparameters={}
  local factor=targetproperties.math_is_scaled and 1 or targetparameters.factor
  for name,value in next,mathparameters do
   if unscaled[name] then
    targetmathparameters[name]=value
   else
    targetmathparameters[name]=value*factor
   end
  end
  if not targetmathparameters.FractionDelimiterSize then
   targetmathparameters.FractionDelimiterSize=1.01*targetparameters.size
  end
  if not mathparameters.FractionDelimiterDisplayStyleSize then
   targetmathparameters.FractionDelimiterDisplayStyleSize=2.40*targetparameters.size
  end
  if not targetmathparameters.SpaceBeforeScript then
   targetmathparameters.SpaceBeforeScript=targetmathparameters.SpaceAfterScript
  end
  target.mathparameters=targetmathparameters
 end
end
function constructors.beforecopyingcharacters(target,original)
end
function constructors.aftercopyingcharacters(target,original)
end
local nofinstances=0
local instances=setmetatableindex(function(t,k)
 nofinstances=nofinstances+1
 t[k]=nofinstances
 return nofinstances
end)
function constructors.trytosharefont(target,tfmdata)
 local properties=target.properties
 local instance=properties.instance
 if instance then
  local fullname=target.fullname
  local fontname=target.fontname
  local psname=target.psname
  local format=tfmdata.properties.format
  if format=="opentype" then
   target.streamprovider=1
  elseif format=="truetype" then
   target.streamprovider=2
  else
   target.streamprovider=0
  end
  if target.streamprovider>0 then
   if fullname then
    fullname=fullname..":"..instances[instance]
    target.fullname=fullname
   end
   if fontname then
    fontname=fontname..":"..instances[instance]
    target.fontname=fontname
   end
   if psname then
    psname=psname..":"..instances[instance]
    target.psname=psname
   end
  end
 end
end
local synonyms={
 exheight="x_height",
 xheight="x_height",
 ex="x_height",
 emwidth="quad",
 em="quad",
 spacestretch="space_stretch",
 stretch="space_stretch",
 spaceshrink="space_shrink",
 shrink="space_shrink",
 extraspace="extra_space",
 xspace="extra_space",
 slantperpoint="slant",
}
function constructors.enhanceparameters(parameters)
 local mt=getmetatable(parameters)
 local getter=function(t,k)
  if not k then
   return nil
  end
  local s=synonyms[k]
  if s then
   return rawget(t,s) or (mt and mt[s]) or nil
  end
  if k=="spacing" then
   return {
    width=t.space,
    stretch=t.space_stretch,
    shrink=t.space_shrink,
    extra=t.extra_space,
   }
  end
  return mt and mt[k] or nil
 end
 local setter=function(t,k,v)
  if not k then
   return 0
  end
  local s=synonyms[k]
  if s then
   rawset(t,s,v)
  elseif k=="spacing" then
   if type(v)=="table" then
    rawset(t,"space",v.width or 0)
    rawset(t,"space_stretch",v.stretch or 0)
    rawset(t,"space_shrink",v.shrink or 0)
    rawset(t,"extra_space",v.extra or 0)
   end
  else
   rawset(t,k,v)
  end
 end
 setmetatable(parameters,{
  __index=getter,
  __newindex=setter,
 })
end
local function mathkerns(v,vdelta)
 local k={}
 for i=1,#v do
  local entry=v[i]
  local height=entry.height
  local kern=entry.kern
  k[i]={
   height=height and vdelta*height or 0,
   kern=kern   and vdelta*kern   or 0,
  }
 end
 return k
end
local psfake=0
local function fixedpsname(psname,fallback)
 local usedname=psname
 if psname and psname~="" then
  if find(psname," ",1,true) then
   usedname=gsub(psname,"[%s]+","-")
  else
  end
 elseif not fallback or fallback=="" then
  psfake=psfake+1
  psname="fakename-"..psfake
 else
  psname=fallback
  usedname=gsub(psname,"[^a-zA-Z0-9]+","-")
 end
 return usedname,psname~=usedname
end
function constructors.scale(tfmdata,specification)
 local target={}
 if tonumber(specification) then
  specification={ size=specification }
 end
 target.specification=specification
 local scaledpoints=specification.size
 local relativeid=specification.relativeid
 local properties=tfmdata.properties  or {}
 local goodies=tfmdata.goodies  or {}
 local resources=tfmdata.resources   or {}
 local descriptions=tfmdata.descriptions   or {} 
 local characters=tfmdata.characters  or {} 
 local changed=tfmdata.changed  or {} 
 local shared=tfmdata.shared   or {}
 local parameters=tfmdata.parameters  or {}
 local mathparameters=tfmdata.mathparameters or {}
 local targetcharacters={}
 local targetdescriptions=derivetable(descriptions)
 local targetparameters=derivetable(parameters)
 local targetproperties=derivetable(properties)
 local targetgoodies=goodies      
 target.characters=targetcharacters
 target.descriptions=targetdescriptions
 target.parameters=targetparameters
 target.properties=targetproperties
 target.goodies=targetgoodies
 target.shared=shared
 target.resources=resources
 target.unscaled=tfmdata
 local mathsize=tonumber(specification.mathsize) or 0
 local textsize=tonumber(specification.textsize) or scaledpoints
 local forcedsize=tonumber(parameters.mathsize   ) or 0 
 local extrafactor=tonumber(specification.factor  ) or 1
 if (mathsize==2 or forcedsize==2) and parameters.scriptpercentage then
  scaledpoints=parameters.scriptpercentage*textsize/100
 elseif (mathsize==3 or forcedsize==3) and parameters.scriptscriptpercentage then
  scaledpoints=parameters.scriptscriptpercentage*textsize/100
 elseif forcedsize>1000 then 
  scaledpoints=forcedsize
 else
 end
 targetparameters.mathsize=mathsize 
 targetparameters.textsize=textsize 
 targetparameters.forcedsize=forcedsize  
 targetparameters.extrafactor=extrafactor
 local addtounicode=constructors.addtounicode
 local tounicode=fonts.mappings.tounicode
 local unknowncode=tounicode(0xFFFD)
 local defaultwidth=resources.defaultwidth  or 0
 local defaultheight=resources.defaultheight or 0
 local defaultdepth=resources.defaultdepth or 0
 local units=parameters.units or 1000
 targetproperties.language=properties.language or "dflt" 
 targetproperties.script=properties.script   or "dflt" 
 targetproperties.mode=properties.mode  or "base" 
 targetproperties.method=properties.method
 local askedscaledpoints=scaledpoints
 local scaledpoints,delta=constructors.calculatescale(tfmdata,scaledpoints,nil,specification)
 local hdelta=delta
 local vdelta=delta
 target.designsize=parameters.designsize 
 target.units=units
 target.units_per_em=units
 local direction=properties.direction or tfmdata.direction or 0 
 target.direction=direction
 properties.direction=direction
 target.size=scaledpoints
 target.encodingbytes=properties.encodingbytes or 1
 target.subfont=properties.subfont
 target.embedding=properties.embedding or "subset"
 target.tounicode=1
 target.cidinfo=properties.cidinfo
 target.format=properties.format
 target.cache=constructors.cacheintex and "yes" or "renew"
 local original=properties.original or tfmdata.original
 local fontname=properties.fontname or tfmdata.fontname
 local fullname=properties.fullname or tfmdata.fullname
 local filename=properties.filename or tfmdata.filename
 local psname=properties.psname   or tfmdata.psname
 local name=properties.name  or tfmdata.name
 local psname,psfixed=fixedpsname(psname,fontname or fullname or file.nameonly(filename))
 target.original=original
 target.fontname=fontname
 target.fullname=fullname
 target.filename=filename
 target.psname=psname
 target.name=name
 properties.fontname=fontname
 properties.fullname=fullname
 properties.filename=filename
 properties.psname=psname
 properties.name=name
 local expansion=parameters.expansion
 if expansion then
  target.stretch=expansion.stretch
  target.shrink=expansion.shrink
  target.step=expansion.step
 end
 local slantfactor=parameters.slantfactor or 0
 if slantfactor~=0 then
  target.slant=slantfactor*1000
 else
  target.slant=0
 end
 local extendfactor=parameters.extendfactor or 0
 if extendfactor~=0 and extendfactor~=1 then
  hdelta=hdelta*extendfactor
  target.extend=extendfactor*1000
 else
  target.extend=1000 
 end
 local squeezefactor=parameters.squeezefactor or 0
 if squeezefactor~=0 and squeezefactor~=1 then
  vdelta=vdelta*squeezefactor
  target.squeeze=squeezefactor*1000
 else
  target.squeeze=1000 
 end
 local mode=parameters.mode or 0
 if mode~=0 then
  target.mode=mode
 end
 local width=parameters.width or 0
 if width~=0 then
  target.width=width*delta*1000/655360
 end
 targetparameters.factor=delta
 targetparameters.hfactor=hdelta
 targetparameters.vfactor=vdelta
 targetparameters.size=scaledpoints
 targetparameters.units=units
 targetparameters.scaledpoints=askedscaledpoints
 targetparameters.mode=mode
 targetparameters.width=width
 local isvirtual=properties.virtualized or tfmdata.type=="virtual"
 local hasquality=parameters.expansion or parameters.protrusion
 local hasitalics=properties.hasitalics
 local autoitalicamount=properties.autoitalicamount
 local stackmath=not properties.nostackmath
 local haskerns=properties.haskerns  or properties.mode=="base" 
 local hasligatures=properties.hasligatures or properties.mode=="base" 
 local realdimensions=properties.realdimensions
 local writingmode=properties.writingmode or "horizontal"
 local identity=properties.identity or "horizontal"
 local vfonts=target.fonts
 if vfonts and #vfonts>0 then
  target.fonts=fastcopy(vfonts) 
 elseif isvirtual then
  target.fonts={ { id=0 } } 
 end
 if changed and not next(changed) then
  changed=false
 end
 target.type=isvirtual and "virtual" or "real"
 target.writingmode=writingmode=="vertical" and "vertical" or "horizontal"
 target.identity=identity=="vertical" and "vertical" or "horizontal"
 target.postprocessors=tfmdata.postprocessors
 local targetslant=(parameters.slant   or parameters[1] or 0)*factors.pt 
 local targetspace=(parameters.space   or parameters[2] or 0)*hdelta
 local targetspace_stretch=(parameters.space_stretch or parameters[3] or 0)*hdelta
 local targetspace_shrink=(parameters.space_shrink  or parameters[4] or 0)*hdelta
 local targetx_height=(parameters.x_height   or parameters[5] or 0)*vdelta
 local targetquad=(parameters.quad    or parameters[6] or 0)*hdelta
 local targetextra_space=(parameters.extra_space   or parameters[7] or 0)*hdelta
 targetparameters.slant=targetslant 
 targetparameters.space=targetspace
 targetparameters.space_stretch=targetspace_stretch
 targetparameters.space_shrink=targetspace_shrink
 targetparameters.x_height=targetx_height
 targetparameters.quad=targetquad
 targetparameters.extra_space=targetextra_space
 local hshift=parameters.hshift
 if hshift then
  targetparameters.hshift=delta*hshift
 end
 local vshift=parameters.vshift
 if vshift then
  targetparameters.vshift=delta*vshift
 end
 local ascender=parameters.ascender
 if ascender then
  targetparameters.ascender=delta*ascender
 end
 local descender=parameters.descender
 if descender then
  targetparameters.descender=delta*descender
 end
 constructors.enhanceparameters(targetparameters)
 local protrusionfactor=constructors.fixprotrusion and ((targetquad~=0 and 1000/targetquad) or 1) or 1
 local scaledwidth=defaultwidth*hdelta
 local scaledheight=defaultheight*vdelta
 local scaleddepth=defaultdepth*vdelta
 local hasmath=(properties.hasmath or next(mathparameters)) and true
 if hasmath then
  constructors.assignmathparameters(target,tfmdata) 
  properties.hasmath=true
  target.nomath=false
  target.MathConstants=target.mathparameters
  local oldmath=properties.oldmath
  targetproperties.oldmath=oldmath
  target.oldmath=oldmath
 else
  properties.hasmath=false
  target.nomath=true
  target.mathparameters=nil 
 end
 if hasmath then
  local mathitalics=properties.mathitalics
  if mathitalics==false then
   if trace_defining then
    report_defining("%s italics %s for font %a, fullname %a, filename %a","math",hasitalics and "ignored" or "disabled",name,fullname,filename)
   end
   hasitalics=false
   autoitalicamount=false
  end
 else
  local textitalics=properties.textitalics
  if textitalics==false then
   if trace_defining then
    report_defining("%s italics %s for font %a, fullname %a, filename %a","text",hasitalics and "ignored" or "disabled",name,fullname,filename)
   end
   hasitalics=false
   autoitalicamount=false
  end
 end
 if trace_defining then
  report_defining("defining tfm, name %a, fullname %a, filename %a, %spsname %a, hscale %a, vscale %a, math %a, italics %a",
   name,fullname,filename,psfixed and "(fixed) " or "",psname,hdelta,vdelta,
   hasmath and "enabled" or "disabled",hasitalics and "enabled" or "disabled")
 end
 constructors.beforecopyingcharacters(target,tfmdata)
 local sharedkerns={}
 for unicode,character in next,characters do
  local chr,description,index
  if changed then
   local c=changed[unicode]
   if c and c~=unicode then
    if c then
     description=descriptions[c] or descriptions[unicode] or character
     character=characters[c] or character
     index=description.index or c
    else
     description=descriptions[unicode] or character
     index=description.index or unicode
    end
   else
    description=descriptions[unicode] or character
    index=description.index or unicode
   end
  else
   description=descriptions[unicode] or character
   index=description.index or unicode
  end
  local width=description.width
  local height=description.height
  local depth=description.depth
  local isunicode=description.unicode
  if realdimensions then
   if not height or height==0 then
    local bb=description.boundingbox
    local ht=bb[4]
    if ht~=0 then
     height=ht
    end
    if not depth or depth==0 then
     local dp=-bb[2]
     if dp~=0 then
      depth=dp
     end
    end
   elseif not depth or depth==0 then
    local dp=-description.boundingbox[2]
    if dp~=0 then
     depth=dp
    end
   end
  end
  if width  then width=hdelta*width  else width=scaledwidth  end
  if height then height=vdelta*height else height=scaledheight end
  if depth and depth~=0 then
   depth=delta*depth
   if isunicode then
    chr={
     index=index,
     height=height,
     depth=depth,
     width=width,
     unicode=isunicode,
    }
   else
    chr={
     index=index,
     height=height,
     depth=depth,
     width=width,
    }
   end
  else
   if isunicode then
    chr={
     index=index,
     height=height,
     width=width,
     unicode=isunicode,
    }
   else
    chr={
     index=index,
     height=height,
     width=width,
    }
   end
  end
  if addtounicode then
   chr.tounicode=isunicode and tounicode(isunicode) or unknowncode
  end
  if hasquality then
   local ve=character.expansion_factor
   if ve then
    chr.expansion_factor=ve*1000 
   end
   local vl=character.left_protruding
   if vl then
    chr.left_protruding=protrusionfactor*width*vl
   end
   local vr=character.right_protruding
   if vr then
    chr.right_protruding=protrusionfactor*width*vr
   end
  end
  if hasmath then
   local vn=character.next
   if vn then
    chr.next=vn
   else
    local vv=character.vert_variants
    if vv then
     local t={}
     for i=1,#vv do
      local vvi=vv[i]
      local s=vvi["start"]   or 0
      local e=vvi["end"]  or 0
      local a=vvi["advance"] or 0
      t[i]={ 
       ["start"]=s==0 and 0 or s*vdelta,
       ["end"]=e==0 and 0 or e*vdelta,
       ["advance"]=a==0 and 0 or a*vdelta,
       ["extender"]=vvi["extender"],
       ["glyph"]=vvi["glyph"],
      }
     end
     chr.vert_variants=t
    else
     local hv=character.horiz_variants
     if hv then
      local t={}
      for i=1,#hv do
       local hvi=hv[i]
       local s=hvi["start"]   or 0
       local e=hvi["end"]  or 0
       local a=hvi["advance"] or 0
       t[i]={ 
        ["start"]=s==0 and 0 or s*hdelta,
        ["end"]=e==0 and 0 or e*hdelta,
        ["advance"]=a==0 and 0 or a*hdelta,
        ["extender"]=hvi["extender"],
        ["glyph"]=hvi["glyph"],
       }
      end
      chr.horiz_variants=t
     end
    end
   end
   local vi=character.vert_italic
   if vi and vi~=0 then
    chr.vert_italic=vi*hdelta
   end
   local va=character.accent
   if va then
    chr.top_accent=vdelta*va
   end
   if stackmath then
    local mk=character.mathkerns
    if mk then
     local tr=mk.topright
     local tl=mk.topleft
     local br=mk.bottomright
     local bl=mk.bottomleft
     chr.mathkern={ 
      top_right=tr and mathkerns(tr,vdelta) or nil,
      top_left=tl and mathkerns(tl,vdelta) or nil,
      bottom_right=br and mathkerns(br,vdelta) or nil,
      bottom_left=bl and mathkerns(bl,vdelta) or nil,
     }
    end
   end
   if hasitalics then
    local vi=character.italic
    if vi and vi~=0 then
     chr.italic=vi*hdelta
    end
   end
  elseif autoitalicamount then 
   local vi=description.italic
   if not vi then
    local bb=description.boundingbox
    if bb then
     local vi=bb[3]-description.width+autoitalicamount
     if vi>0 then 
      chr.italic=vi*hdelta
     end
    else
    end
   elseif vi~=0 then
    chr.italic=vi*hdelta
   end
  elseif hasitalics then 
   local vi=character.italic
   if vi and vi~=0 then
    chr.italic=vi*hdelta
   end
  end
  if haskerns then
   local vk=character.kerns
   if vk then
    local s=sharedkerns[vk]
    if not s then
     s={}
     for k,v in next,vk do s[k]=v*hdelta end
     sharedkerns[vk]=s
    end
    chr.kerns=s
   end
  end
  if hasligatures then
   local vl=character.ligatures
   if vl then
    if true then
     chr.ligatures=vl 
    else
     local tt={}
     for i,l in next,vl do
      tt[i]=l
     end
     chr.ligatures=tt
    end
   end
  end
  if isvirtual then
   local vc=character.commands
   if vc then
    local ok=false
    for i=1,#vc do
     local key=vc[i][1]
     if key=="right" or key=="down" or key=="rule" then
      ok=true
      break
     end
    end
    if ok then
     local tt={}
     for i=1,#vc do
      local ivc=vc[i]
      local key=ivc[1]
      if key=="right" then
       tt[i]={ key,ivc[2]*hdelta }
      elseif key=="down" then
       tt[i]={ key,ivc[2]*vdelta }
      elseif key=="rule" then
       tt[i]={ key,ivc[2]*vdelta,ivc[3]*hdelta }
      else 
       tt[i]=ivc 
      end
     end
     chr.commands=tt
    else
     chr.commands=vc
    end
   end
  end
  targetcharacters[unicode]=chr
 end
 properties.setitalics=hasitalics
 constructors.aftercopyingcharacters(target,tfmdata)
 constructors.trytosharefont(target,tfmdata)
 local vfonts=target.fonts
 if isvirtual or target.type=="virtual" or properties.virtualized then
  properties.virtualized=true
  target.type="virtual"
  if not vfonts or #vfonts==0 then
   target.fonts={ { id=0 } }
  end
 elseif vfonts then
  properties.virtualized=true
  target.type="virtual"
  if #vfonts==0 then
   target.fonts={ { id=0 } }
  end
 end
 return target
end
function constructors.finalize(tfmdata)
 if tfmdata.properties and tfmdata.properties.finalized then
  return
 end
 if not tfmdata.characters then
  return nil
 end
 if not tfmdata.goodies then
  tfmdata.goodies={} 
 end
 local parameters=tfmdata.parameters
 if not parameters then
  return nil
 end
 if not parameters.expansion then
  parameters.expansion={
   stretch=tfmdata.stretch or 0,
   shrink=tfmdata.shrink  or 0,
   step=tfmdata.step or 0,
  }
 end
 if not parameters.size then
  parameters.size=tfmdata.size
 end
 if not parameters.mode then
  parameters.mode=0
 end
 if not parameters.width then
  parameters.width=0
 end
 if not parameters.slantfactor then
  parameters.slantfactor=(tfmdata.slant or 0)/1000
 end
 if not parameters.extendfactor then
  parameters.extendfactor=(tfmdata.extend or 1000)/1000
 end
 if not parameters.squeezefactor then
  parameters.squeezefactor=(tfmdata.squeeze or 1000)/1000
 end
 local designsize=parameters.designsize
 if designsize then
  parameters.minsize=tfmdata.minsize or designsize
  parameters.maxsize=tfmdata.maxsize or designsize
 else
  designsize=factors.pt*10
  parameters.designsize=designsize
  parameters.minsize=designsize
  parameters.maxsize=designsize
 end
 parameters.minsize=tfmdata.minsize or parameters.designsize
 parameters.maxsize=tfmdata.maxsize or parameters.designsize
 if not parameters.units then
  parameters.units=tfmdata.units or tfmdata.units_per_em or 1000
 end
 if not tfmdata.descriptions then
  local descriptions={} 
  setmetatableindex(descriptions,function(t,k) local v={} t[k]=v return v end)
  tfmdata.descriptions=descriptions
 end
 local properties=tfmdata.properties
 if not properties then
  properties={}
  tfmdata.properties=properties
 end
 if not properties.virtualized then
  properties.virtualized=tfmdata.type=="virtual"
 end
 properties.fontname=properties.fontname or tfmdata.fontname
 properties.filename=properties.filename or tfmdata.filename
 properties.fullname=properties.fullname or tfmdata.fullname
 properties.name=properties.name  or tfmdata.name
 properties.psname=properties.psname   or tfmdata.psname
 properties.encodingbytes=tfmdata.encodingbytes or 1
 properties.subfont=tfmdata.subfont    or nil
 properties.embedding=tfmdata.embedding  or "subset"
 properties.tounicode=tfmdata.tounicode  or 1
 properties.cidinfo=tfmdata.cidinfo    or nil
 properties.format=tfmdata.format  or "type1"
 properties.direction=tfmdata.direction  or 0
 properties.writingmode=tfmdata.writingmode   or "horizontal"
 properties.identity=tfmdata.identity   or "horizontal"
 properties.usedbitmap=tfmdata.usedbitmap
 if not tfmdata.resources then
  tfmdata.resources={}
 end
 if not tfmdata.shared then
  tfmdata.shared={}
 end
 if not properties.hasmath then
  properties.hasmath=not tfmdata.nomath
 end
 tfmdata.MathConstants=nil
 tfmdata.postprocessors=nil
 tfmdata.fontname=nil
 tfmdata.filename=nil
 tfmdata.fullname=nil
 tfmdata.name=nil 
 tfmdata.psname=nil
 tfmdata.encodingbytes=nil
 tfmdata.subfont=nil
 tfmdata.embedding=nil
 tfmdata.tounicode=nil
 tfmdata.cidinfo=nil
 tfmdata.format=nil
 tfmdata.direction=nil
 tfmdata.type=nil
 tfmdata.nomath=nil
 tfmdata.designsize=nil
 tfmdata.size=nil
 tfmdata.stretch=nil
 tfmdata.shrink=nil
 tfmdata.step=nil
 tfmdata.slant=nil
 tfmdata.extend=nil
 tfmdata.squeeze=nil
 tfmdata.mode=nil
 tfmdata.width=nil
 tfmdata.units=nil
 tfmdata.units_per_em=nil
 tfmdata.cache=nil
 properties.finalized=true
 return tfmdata
end
local hashmethods={}
constructors.hashmethods=hashmethods
function constructors.hashfeatures(specification) 
 local features=specification.features
 if features then
  local t,n={},0
  for category,list in sortedhash(features) do
   if next(list) then
    local hasher=hashmethods[category]
    if hasher then
     local hash=hasher(list)
     if hash then
      n=n+1
      t[n]=category..":"..hash
     end
    end
   end
  end
  if n>0 then
   return concat(t," & ")
  end
 end
 return "unknown"
end
hashmethods.normal=function(list)
 local s={}
 local n=0
 for k,v in next,list do
  if not k then
  elseif k=="number" or k=="features" then
  else
   n=n+1
   if type(v)=="table" then
    local t={}
    local m=0
    for k,v in next,v do
     m=m+1
     t[m]=k..'='..tostring(v)
    end
    sort(t)
    s[n]=k..'={'..concat(t,",").."}"
   else
    s[n]=k..'='..tostring(v)
   end
  end
 end
 if n>0 then
  sort(s)
  return concat(s,"+")
 end
end
function constructors.hashinstance(specification,force)
 local hash=specification.hash
 local size=specification.size
 local fallbacks=specification.fallbacks
 if force or not hash then
  hash=constructors.hashfeatures(specification)
  specification.hash=hash
 end
 if size<1000 and designsizes[hash] then
  size=round(constructors.scaled(size,designsizes[hash]))
 else
  size=round(size)
 end
 specification.size=size
 if fallbacks then
  return hash..' @ '..size..' @ '..fallbacks
 else
  return hash..' @ '..size
 end
end
function constructors.setname(tfmdata,specification) 
 if constructors.namemode=="specification" then
  local specname=specification.specification
  if specname then
   tfmdata.properties.name=specname
   if trace_defining then
    report_otf("overloaded fontname %a",specname)
   end
  end
 end
end
function constructors.checkedfilename(data)
 local foundfilename=data.foundfilename
 if not foundfilename then
  local askedfilename=data.filename or ""
  if askedfilename~="" then
   askedfilename=resolvers.resolve(askedfilename) 
   foundfilename=resolvers.findbinfile(askedfilename,"") or ""
   if foundfilename=="" then
    report_defining("source file %a is not found",askedfilename)
    foundfilename=resolvers.findbinfile(file.basename(askedfilename),"") or ""
    if foundfilename~="" then
     report_defining("using source file %a due to cache mismatch",foundfilename)
    end
   end
  end
  data.foundfilename=foundfilename
 end
 return foundfilename
end
local formats=allocate()
fonts.formats=formats
setmetatableindex(formats,function(t,k)
 local l=lower(k)
 if rawget(t,k) then
  t[k]=l
  return l
 end
 return rawget(t,file.suffix(l))
end)
do
 local function setindeed(mode,source,target,group,name,position)
  local action=source[mode]
  if not action then
   return
  end
  local t=target[mode]
  if not t then
   report_defining("fatal error in setting feature %a, group %a, mode %a",name,group,mode)
   os.exit()
  elseif position then
   insert(t,position,{ name=name,action=action })
  else
   for i=1,#t do
    local ti=t[i]
    if ti.name==name then
     ti.action=action
     return
    end
   end
   insert(t,{ name=name,action=action })
  end
 end
 local function set(group,name,target,source)
  target=target[group]
  if not target then
   report_defining("fatal target error in setting feature %a, group %a",name,group)
   os.exit()
  end
  local source=source[group]
  if not source then
   report_defining("fatal source error in setting feature %a, group %a",name,group)
   os.exit()
  end
  local position=source.position
  setindeed("node",source,target,group,name,position)
  setindeed("base",source,target,group,name,position)
  setindeed("plug",source,target,group,name,position)
 end
 local function register(where,specification)
  local name=specification.name
  if name and name~="" then
   local default=specification.default
   local description=specification.description
   local initializers=specification.initializers
   local processors=specification.processors
   local manipulators=specification.manipulators
   local modechecker=specification.modechecker
   if default then
    where.defaults[name]=default
   end
   if description and description~="" then
    where.descriptions[name]=description
   end
   if initializers then
    set('initializers',name,where,specification)
   end
   if processors then
    set('processors',name,where,specification)
   end
   if manipulators then
    set('manipulators',name,where,specification)
   end
   if modechecker then
      where.modechecker=modechecker
   end
  end
 end
 constructors.registerfeature=register
 function constructors.getfeatureaction(what,where,mode,name)
  what=handlers[what].features
  if what then
   where=what[where]
   if where then
    mode=where[mode]
    if mode then
     for i=1,#mode do
      local m=mode[i]
      if m.name==name then
       return m.action
      end
     end
    end
   end
  end
 end
 local newfeatures={}
 constructors.newfeatures=newfeatures 
 constructors.features=newfeatures
 local function setnewfeatures(what)
  local handler=handlers[what]
  local features=handler.features
  if not features then
   local tables=handler.tables  
   local statistics=handler.statistics 
   features=allocate {
    defaults={},
    descriptions=tables and tables.features or {},
    used=statistics and statistics.usedfeatures or {},
    initializers={ base={},node={},plug={} },
    processors={ base={},node={},plug={} },
    manipulators={ base={},node={},plug={} },
   }
   features.register=function(specification) return register(features,specification) end
   handler.features=features 
  end
  return features
 end
 setmetatable(newfeatures,{
  __call=function(t,k) local v=t[k] return v end,
  __index=function(t,k) local v=setnewfeatures(k) t[k]=v return v end,
 })
end
do
 local newhandler={}
 constructors.handlers=newhandler 
 constructors.newhandler=newhandler
 local function setnewhandler(what) 
  local handler=handlers[what]
  if not handler then
   handler={}
   handlers[what]=handler
  end
  return handler
 end
 setmetatable(newhandler,{
  __call=function(t,k) local v=t[k] return v end,
  __index=function(t,k) local v=setnewhandler(k) t[k]=v return v end,
 })
end
do
 local newenhancer={}
 constructors.enhancers=newenhancer
 constructors.newenhancer=newenhancer
 local function setnewenhancer(format)
  local handler=handlers[format]
  local enhancers=handler.enhancers
  if not enhancers then
   local actions=allocate() 
   local before=allocate()
   local after=allocate()
   local order=allocate()
   local known={}
   local nofsteps=0
   local patches={ before=before,after=after }
   local trace=false
   local report=logs.reporter("fonts",format.." enhancing")
   trackers.register(format..".loading",function(v) trace=v end)
   local function enhance(name,data,filename,raw)
    local enhancer=actions[name]
    if enhancer then
     if trace then
      report("apply enhancement %a to file %a",name,filename)
      ioflush()
     end
     enhancer(data,filename,raw)
    else
    end
   end
   local function apply(data,filename,raw)
    local basename=file.basename(lower(filename))
    if trace then
     report("%s enhancing file %a","start",filename)
    end
    ioflush() 
    for e=1,nofsteps do
     local enhancer=order[e]
     local b=before[enhancer]
     if b then
      for pattern,action in next,b do
       if find(basename,pattern) then
        action(data,filename,raw)
       end
      end
     end
     enhance(enhancer,data,filename,raw) 
     local a=after[enhancer]
     if a then
      for pattern,action in next,a do
       if find(basename,pattern) then
        action(data,filename,raw)
       end
      end
     end
     ioflush() 
    end
    if trace then
     report("%s enhancing file %a","stop",filename)
    end
    ioflush() 
   end
   local function register(what,action)
    if action then
     if actions[what] then
     else
      nofsteps=nofsteps+1
      order[nofsteps]=what
      known[what]=nofsteps
     end
     actions[what]=action
    else
     report("bad enhancer %a",what)
    end
   end
   local function patch(what,where,pattern,action)
    local pw=patches[what]
    if pw then
     local ww=pw[where]
     if ww then
      ww[pattern]=action
     else
      pw[where]={ [pattern]=action }
      if not known[where] then
       nofsteps=nofsteps+1
       order[nofsteps]=where
       known[where]=nofsteps
      end
     end
    end
   end
   enhancers={
    register=register,
    apply=apply,
    patch=patch,
    report=report,
    patches={
     register=patch,
     report=report,
    },
   }
   handler.enhancers=enhancers
  end
  return enhancers
 end
 setmetatable(newenhancer,{
  __call=function(t,k) local v=t[k] return v end,
  __index=function(t,k) local v=setnewenhancer(k) t[k]=v return v end,
 })
end
function constructors.checkedfeatures(what,features)
 local defaults=handlers[what].features.defaults
 if features and next(features) then
  features=fastcopy(features) 
  for key,value in next,defaults do
   if features[key]==nil then
    features[key]=value
   end
  end
  return features
 else
  return fastcopy(defaults) 
 end
end
function constructors.initializefeatures(what,tfmdata,features,trace,report)
 if features and next(features) then
  local properties=tfmdata.properties or {} 
  local whathandler=handlers[what]
  local whatfeatures=whathandler.features
  local whatmodechecker=whatfeatures.modechecker
  local mode=properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features,features.mode)) or features.mode or "base"
  properties.mode=mode 
  features.mode=mode
  local done={}
  while true do
   local redo=false
   local initializers=whatfeatures.initializers[mode]
   if initializers then
    for i=1,#initializers do
     local step=initializers[i]
     local feature=step.name
     local value=features[feature]
     if not value then
     elseif done[feature] then
     else
      local action=step.action
      if trace then
       report("initializing feature %a to %a for mode %a for font %a",feature,
        value,mode,tfmdata.properties.fullname)
      end
      action(tfmdata,value,features) 
      if mode~=properties.mode or mode~=features.mode then
       if whatmodechecker then
        properties.mode=whatmodechecker(tfmdata,features,properties.mode) 
        features.mode=properties.mode
       end
       if mode~=properties.mode then
        mode=properties.mode
        redo=true
       end
      end
      done[feature]=true
     end
     if redo then
      break
     end
    end
    if not redo then
     break
    end
   else
    break
   end
  end
  properties.mode=mode 
  return true
 else
  return false
 end
end
function constructors.collectprocessors(what,tfmdata,features,trace,report)
 local processes={}
 local nofprocesses=0
 if features and next(features) then
  local properties=tfmdata.properties
  local whathandler=handlers[what]
  local whatfeatures=whathandler.features
  local whatprocessors=whatfeatures.processors
  local mode=properties.mode
  local processors=whatprocessors[mode]
  if processors then
   for i=1,#processors do
    local step=processors[i]
    local feature=step.name
    if features[feature] then
     local action=step.action
     if trace then
      report("installing feature processor %a for mode %a for font %a",feature,mode,tfmdata.properties.fullname)
     end
     if action then
      nofprocesses=nofprocesses+1
      processes[nofprocesses]=action
     end
    end
   end
  elseif trace then
   report("no feature processors for mode %a for font %a",mode,properties.fullname)
  end
 end
 return processes
end
function constructors.applymanipulators(what,tfmdata,features,trace,report)
 if features and next(features) then
  local properties=tfmdata.properties
  local whathandler=handlers[what]
  local whatfeatures=whathandler.features
  local whatmanipulators=whatfeatures.manipulators
  local mode=properties.mode
  local manipulators=whatmanipulators[mode]
  if manipulators then
   for i=1,#manipulators do
    local step=manipulators[i]
    local feature=step.name
    local value=features[feature]
    if value then
     local action=step.action
     if trace then
      report("applying feature manipulator %a for mode %a for font %a",feature,mode,properties.fullname)
     end
     if action then
      action(tfmdata,feature,value)
     end
    end
   end
  end
 end
end
function constructors.addcoreunicodes(unicodes) 
 if not unicodes then
  unicodes={}
 end
 unicodes.space=0x0020
 unicodes.hyphen=0x002D
 unicodes.zwj=0x200D
 unicodes.zwnj=0x200C
 return unicodes
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-con”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-enc” c24fd6b4f34f87b9c4ff5e6193ce2656] ---

if not modules then modules={} end modules ['luatex-font-enc']={
 version=1.001,
 comment="companion to luatex-*.tex",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
local fonts=fonts
local encodings={}
fonts.encodings=encodings
encodings.agl={}
encodings.known={}
encodings.glyphlistfilename="font-age.lua"
setmetatable(encodings.agl,{ __index=function(t,k)
 if k=="unicodes" then
  logs.report("fonts","loading (extended) adobe glyph list")
  local foundname=resolvers.findfile(encodings.glyphlistfilename) or ""
  local unicodes=foundname~="" and dofile(foundname)
  if type(unicodes)~="table" then
   logs.report("fonts","missing or invalid (extended) adobe glyph list")
   unicodes={}
  end
  encodings.agl={ unicodes=unicodes }
  return unicodes
 else
  return nil
 end
end })
encodings.cache=containers.define("fonts","enc",encodings.version,true)
function encodings.load(filename)
 local name=file.removesuffix(filename)
 local data=containers.read(encodings.cache,name)
 if data then
  return data
 end
 local vector,tag,hash,unicodes={},"",{},{}
 local foundname=resolvers.findfile(filename,'enc')
 if foundname and foundname~="" then
  local ok,encoding,size=resolvers.loadbinfile(foundname)
  if ok and encoding then
   encoding=string.gsub(encoding,"%%(.-)\n","")
   local unicoding=encodings.agl.unicodes
   local tag,vec=string.match(encoding,"/(%w+)%s*%[(.*)%]%s*def")
   local i=0
   for ch in string.gmatch(vec,"/([%a%d%.]+)") do
    if ch~=".notdef" then
     vector[i]=ch
     if not hash[ch] then
      hash[ch]=i
     else
     end
     local u=unicoding[ch]
     if u then
      unicodes[u]=i
     end
    end
    i=i+1
   end
  end
 end
 local data={
  name=name,
  tag=tag,
  vector=vector,
  hash=hash,
  unicodes=unicodes
 }
 return containers.write(encodings.cache,name,data)
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-enc”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-cid” 22b0367742fb253deef84ef7ccf5e8de] ---

if not modules then modules={} end modules ['font-cid']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local format,match,lower=string.format,string.match,string.lower
local tonumber=tonumber
local P,S,R,C,V,lpegmatch=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.match
local fonts,logs,trackers=fonts,logs,trackers
local trace_loading=false  trackers.register("otf.loading",function(v) trace_loading=v end)
local report_otf=logs.reporter("fonts","otf loading")
local cid={}
fonts.cid=cid
local cidmap={}
local cidmax=10
local number=C(R("09","af","AF")^1)
local space=S(" \n\r\t")
local spaces=space^0
local period=P(".")
local periods=period*period
local name=P("/")*C((1-space)^1)
local unicodes,names={},{} 
local function do_one(a,b)
 unicodes[tonumber(a)]=tonumber(b,16)
end
local function do_range(a,b,c)
 c=tonumber(c,16)
 for i=tonumber(a),tonumber(b) do
  unicodes[i]=c
  c=c+1
 end
end
local function do_name(a,b)
 names[tonumber(a)]=b
end
local grammar=P { "start",
 start=number*spaces*number*V("series"),
 series=(spaces*(V("one")+V("range")+V("named")))^1,
 one=(number*spaces*number)/do_one,
 range=(number*periods*number*spaces*number)/do_range,
 named=(number*spaces*name)/do_name
}
local function loadcidfile(filename)
 local data=io.loaddata(filename)
 if data then
  unicodes,names={},{}
  lpegmatch(grammar,data)
  local supplement,registry,ordering=match(filename,"^(.-)%-(.-)%-()%.(.-)$")
  return {
   supplement=supplement,
   registry=registry,
   ordering=ordering,
   filename=filename,
   unicodes=unicodes,
   names=names,
  }
 end
end
cid.loadfile=loadcidfile 
local template="%s-%s-%s.cidmap"
local function locate(registry,ordering,supplement)
 local filename=format(template,registry,ordering,supplement)
 local hashname=lower(filename)
 local found=cidmap[hashname]
 if not found then
  if trace_loading then
   report_otf("checking cidmap, registry %a, ordering %a, supplement %a, filename %a",registry,ordering,supplement,filename)
  end
  local fullname=resolvers.findfile(filename,'cid') or ""
  if fullname~="" then
   found=loadcidfile(fullname)
   if found then
    if trace_loading then
     report_otf("using cidmap file %a",filename)
    end
    cidmap[hashname]=found
    found.usedname=file.basename(filename)
   end
  end
 end
 return found
end
function cid.getmap(specification)
 if not specification then
  report_otf("invalid cidinfo specification, table expected")
  return
 end
 local registry=specification.registry
 local ordering=specification.ordering
 local supplement=specification.supplement
 local filename=format(registry,ordering,supplement)
 local lowername=lower(filename)
 local found=cidmap[lowername]
 if found then
  return found
 end
 if ordering=="Identity" then
  local found={
   supplement=supplement,
   registry=registry,
   ordering=ordering,
   filename=filename,
   unicodes={},
   names={},
  }
  cidmap[lowername]=found
  return found
 end
 if trace_loading then
  report_otf("cidmap needed, registry %a, ordering %a, supplement %a",registry,ordering,supplement)
 end
 found=locate(registry,ordering,supplement)
 if not found then
  local supnum=tonumber(supplement)
  local cidnum=nil
  if supnum<cidmax then
   for s=supnum+1,cidmax do
    local c=locate(registry,ordering,s)
    if c then
     found,cidnum=c,s
     break
    end
   end
  end
  if not found and supnum>0 then
   for s=supnum-1,0,-1 do
    local c=locate(registry,ordering,s)
    if c then
     found,cidnum=c,s
     break
    end
   end
  end
  registry=lower(registry)
  ordering=lower(ordering)
  if found and cidnum>0 then
   for s=0,cidnum-1 do
    local filename=format(template,registry,ordering,s)
    if not cidmap[filename] then
     cidmap[filename]=found
    end
   end
  end
 end
 return found
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-cid”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-map” c4a39db5ad822b348aa61bca5f4a599a] ---

if not modules then modules={} end modules ['font-map']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local tonumber,next,type=tonumber,next,type
local match,format,find,concat,gsub,lower=string.match,string.format,string.find,table.concat,string.gsub,string.lower
local P,R,S,C,Ct,Cc,lpegmatch=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cc,lpeg.match
local formatters=string.formatters
local sortedhash,sortedkeys=table.sortedhash,table.sortedkeys
local idiv=number.idiv
local trace_loading=false  trackers.register("fonts.loading",function(v) trace_loading=v end)
local trace_mapping=false  trackers.register("fonts.mapping",function(v) trace_mapping=v end)
local report_fonts=logs.reporter("fonts","loading")
local force_ligatures=false  directives.register("fonts.mapping.forceligatures",function(v) force_ligatures=v end)
local fonts=fonts or {}
local mappings=fonts.mappings or {}
fonts.mappings=mappings
local allocate=utilities.storage.allocate
local hex=R("AF","af","09")
local hexfour=(hex*hex*hex^-2)/function(s) return tonumber(s,16) end
local hexsix=(hex*hex*hex^-4)/function(s) return tonumber(s,16) end
local dec=(R("09")^1)/tonumber
local period=P(".")
local unicode=(P("uni")+P("UNI"))*(hexfour*(period+P(-1))*Cc(false)+Ct(hexfour^1)*Cc(true)) 
local ucode=(P("u")+P("U")  )*(hexsix*(period+P(-1))*Cc(false)+Ct(hexsix^1)*Cc(true)) 
local index=P("index")*dec*Cc(false)
local parser=unicode+ucode+index
local parsers={}
local function makenameparser(str)
 if not str or str=="" then
  return parser
 else
  local p=parsers[str]
  if not p then
   p=P(str)*period*dec*Cc(false)
   parsers[str]=p
  end
  return p
 end
end
local f_single=formatters["%04X"]
local f_double=formatters["%04X%04X"]
local s_unknown="FFFD"
local function tounicode16(unicode)
 if unicode<0xD7FF or (unicode>0xDFFF and unicode<=0xFFFF) then
  return f_single(unicode)
 elseif unicode>=0x00E000 and unicode<=0x00F8FF then
  return s_unknown
 elseif unicode>=0x0F0000 and unicode<=0x0FFFFF then
  return s_unknown
 elseif unicode>=0x100000 and unicode<=0x10FFFF then
  return s_unknown
 elseif unicode>=0x00D800 and unicode<=0x00DFFF then
  return s_unknown
 else
  unicode=unicode-0x10000
  return f_double(idiv(k,0x400)+0xD800,unicode%0x400+0xDC00)
 end
end
local function tounicode16sequence(unicodes)
 local t={}
 for l=1,#unicodes do
  local u=unicodes[l]
  if u<0xD7FF or (u>0xDFFF and u<=0xFFFF) then
   t[l]=f_single(u)
  elseif unicode>=0x00E000 and unicode<=0x00F8FF then
   t[l]=s_unknown
  elseif unicode>=0x0F0000 and unicode<=0x0FFFFF then
   t[l]=s_unknown
  elseif unicode>=0x100000 and unicode<=0x10FFFF then
   t[l]=s_unknown
  elseif unicode>=0x00D7FF and unicode<=0x00DFFF then
   t[l]=s_unknown
  else
   u=u-0x10000
   t[l]=f_double(idiv(k,0x400)+0xD800,u%0x400+0xDC00)
  end
 end
 return concat(t)
end
local hash={}
local conc={}
table.setmetatableindex(hash,function(t,k)
 local v
 if k<0xD7FF or (k>0xDFFF and k<=0xFFFF) then
  v=f_single(k)
 else
  local k=k-0x10000
  v=f_double(idiv(k,0x400)+0xD800,k%0x400+0xDC00)
 end
 t[k]=v
 return v
end)
local function tounicode(k)
 if type(k)=="table" then
  local n=#k
  for l=1,n do
   conc[l]=hash[k[l]]
  end
  return concat(conc,"",1,n)
 elseif k>=0x00E000 and k<=0x00F8FF then
  return s_unknown
 elseif k>=0x0F0000 and k<=0x0FFFFF then
  return s_unknown
 elseif k>=0x100000 and k<=0x10FFFF then
  return s_unknown
 elseif k>=0x00D7FF and k<=0x00DFFF then
  return s_unknown
 else
  return hash[k]
 end
end
local function fromunicode16(str)
 if #str==4 then
  return tonumber(str,16)
 else
  local l,r=match(str,"(....)(....)")
  return 0x10000+(tonumber(l,16)-0xD800)*0x400+tonumber(r,16)-0xDC00
 end
end
mappings.makenameparser=makenameparser
mappings.tounicode=tounicode
mappings.tounicode16=tounicode16
mappings.tounicode16sequence=tounicode16sequence
mappings.fromunicode16=fromunicode16
local ligseparator=P("_")
local varseparator=P(".")
local namesplitter=Ct(C((1-ligseparator-varseparator)^1)*(ligseparator*C((1-ligseparator-varseparator)^1))^0)
do
 local overloads={
  IJ={ name="I_J",unicode={ 0x49,0x4A },mess=0x0132 },
  ij={ name="i_j",unicode={ 0x69,0x6A },mess=0x0133 },
  ff={ name="f_f",unicode={ 0x66,0x66 },mess=0xFB00 },
  fi={ name="f_i",unicode={ 0x66,0x69 },mess=0xFB01 },
  fl={ name="f_l",unicode={ 0x66,0x6C },mess=0xFB02 },
  ffi={ name="f_f_i",unicode={ 0x66,0x66,0x69 },mess=0xFB03 },
  ffl={ name="f_f_l",unicode={ 0x66,0x66,0x6C },mess=0xFB04 },
  fj={ name="f_j",unicode={ 0x66,0x6A } },
  fk={ name="f_k",unicode={ 0x66,0x6B } },
 }
 local o=allocate {}
 for k,v in next,overloads do
  local name=v.name
  local mess=v.mess
  if name then
   o[name]=v
  end
  if mess then
   o[mess]=v
  end
  o[k]=v
 end
 mappings.overloads=o
end
function mappings.addtounicode(data,filename,checklookups,forceligatures)
 local resources=data.resources
 local unicodes=resources.unicodes
 if not unicodes then
  if trace_mapping then
   report_fonts("no unicode list, quitting tounicode for %a",filename)
  end
  return
 end
 local properties=data.properties
 local descriptions=data.descriptions
 local overloads=mappings.overloads
 unicodes['space']=unicodes['space']  or 32
 unicodes['hyphen']=unicodes['hyphen'] or 45
 unicodes['zwj']=unicodes['zwj'] or 0x200D
 unicodes['zwnj']=unicodes['zwnj']   or 0x200C
 local private=fonts.constructors and fonts.constructors.privateoffset or 0xF0000 
 local unicodevector=fonts.encodings.agl.unicodes or {} 
 local contextvector=fonts.encodings.agl.ctxcodes or {} 
 local missing={}
 local nofmissing=0
 local oparser=nil
 local cidnames=nil
 local cidcodes=nil
 local cidinfo=properties.cidinfo
 local usedmap=cidinfo and fonts.cid.getmap(cidinfo)
 local uparser=makenameparser() 
 if usedmap then
    oparser=usedmap and makenameparser(cidinfo.ordering)
    cidnames=usedmap.names
    cidcodes=usedmap.unicodes
 end
 local ns=0
 local nl=0
 local dlist=sortedkeys(descriptions)
 for i=1,#dlist do
  local du=dlist[i]
  local glyph=descriptions[du]
  local name=glyph.name
  if name then
   local overload=overloads[name] or overloads[du]
   if overload then
    glyph.unicode=overload.unicode
   else
    local gu=glyph.unicode 
    if not gu or gu==-1 or du>=private or (du>=0xE000 and du<=0xF8FF) or du==0xFFFE or du==0xFFFF then
     local unicode=unicodevector[name] or contextvector[name]
     if unicode then
      glyph.unicode=unicode
      ns=ns+1
     end
     if (not unicode) and usedmap then
      local foundindex=lpegmatch(oparser,name)
      if foundindex then
       unicode=cidcodes[foundindex] 
       if unicode then
        glyph.unicode=unicode
        ns=ns+1
       else
        local reference=cidnames[foundindex] 
        if reference then
         local foundindex=lpegmatch(oparser,reference)
         if foundindex then
          unicode=cidcodes[foundindex]
          if unicode then
           glyph.unicode=unicode
           ns=ns+1
          end
         end
         if not unicode or unicode=="" then
          local foundcodes,multiple=lpegmatch(uparser,reference)
          if foundcodes then
           glyph.unicode=foundcodes
           if multiple then
            nl=nl+1
            unicode=true
           else
            ns=ns+1
            unicode=foundcodes
           end
          end
         end
        end
       end
      end
     end
     if not unicode or unicode=="" then
      local split=lpegmatch(namesplitter,name)
      local nsplit=split and #split or 0 
      if nsplit==0 then
      elseif nsplit==1 then
       local base=split[1]
       local u=unicodes[base] or unicodevector[base] or contextvector[name]
       if not u then
       elseif type(u)=="table" then
        if u[1]<private then
         unicode=u
         glyph.unicode=unicode
        end
       elseif u<private then
        unicode=u
        glyph.unicode=unicode
       end
      else
       local t={}
       local n=0
       for l=1,nsplit do
        local base=split[l]
        local u=unicodes[base] or unicodevector[base] or contextvector[name]
        if not u then
         break
        elseif type(u)=="table" then
         if u[1]>=private then
          break
         end
         n=n+1
         t[n]=u[1]
        else
         if u>=private then
          break
         end
         n=n+1
         t[n]=u
        end
       end
       if n>0 then
        if n==1 then
         unicode=t[1]
        else
         unicode=t
        end
        glyph.unicode=unicode
       end
      end
      nl=nl+1
     end
     if not unicode or unicode=="" then
      local foundcodes,multiple=lpegmatch(uparser,name)
      if foundcodes then
       glyph.unicode=foundcodes
       if multiple then
        nl=nl+1
        unicode=true
       else
        ns=ns+1
        unicode=foundcodes
       end
      end
     end
     local r=overloads[unicode]
     if r then
      unicode=r.unicode
      glyph.unicode=unicode
     end
     if not unicode then
      missing[du]=true
      nofmissing=nofmissing+1
     end
    else
    end
   end
  else
   local overload=overloads[du]
   if overload then
    glyph.unicode=overload.unicode
   elseif not glyph.unicode then
    missing[du]=true
    nofmissing=nofmissing+1
   end
  end
 end
 if type(checklookups)=="function" then
  checklookups(data,missing,nofmissing)
 end
 local unicoded=0
 local collected=fonts.handlers.otf.readers.getcomponents(data) 
 local function resolve(glyph,u)
  local n=#u
  for i=1,n do
   if u[i]>private then
    n=0
    break
   end
  end
  if n>0 then
   if n>1 then
    glyph.unicode=u
   else
    glyph.unicode=u[1]
   end
   unicoded=unicoded+1
  end
 end
 if not collected then
 elseif forceligatures or force_ligatures then
  for i=1,#dlist do
   local du=dlist[i]
   if du>=private or (du>=0xE000 and du<=0xF8FF) then
    local u=collected[du] 
    if u then
     resolve(descriptions[du],u)
    end
   end
  end
 else
  for i=1,#dlist do
   local du=dlist[i]
   if du>=private or (du>=0xE000 and du<=0xF8FF) then
    local glyph=descriptions[du]
    if glyph.class=="ligature" and not glyph.unicode then
     local u=collected[du] 
     if u then
       resolve(glyph,u)
     end
    end
   end
  end
 end
 if trace_mapping and unicoded>0 then
  report_fonts("%n ligature tounicode mappings deduced from gsub ligature features",unicoded)
 end
 if trace_mapping then
  for i=1,#dlist do
   local du=dlist[i]
   local glyph=descriptions[du]
   local name=glyph.name or "-"
   local index=glyph.index or 0
   local unicode=glyph.unicode
   if unicode then
    if type(unicode)=="table" then
     local unicodes={}
     for i=1,#unicode do
      unicodes[i]=formatters("%U",unicode[i])
     end
     report_fonts("internal slot %U, name %a, unicode %U, tounicode % t",index,name,du,unicodes)
    else
     report_fonts("internal slot %U, name %a, unicode %U, tounicode %U",index,name,du,unicode)
    end
   else
    report_fonts("internal slot %U, name %a, unicode %U",index,name,du)
   end
  end
 end
 if trace_loading and (ns>0 or nl>0) then
  report_fonts("%s tounicode entries added, ligatures %s",nl+ns,ns)
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-map”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-vfc” a81c29eda98cd62cbebdb6c93544b50d] ---

if not modules then modules={} end modules ['font-vfc']={
 version=1.001,
 comment="companion to font-ini.mkiv and hand-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local select,type=select,type
local insert=table.insert
local fonts=fonts
local helpers=fonts.helpers
local setmetatableindex=table.setmetatableindex
local push={ "push" }
local pop={ "pop" }
local dummy={ "comment" }
function helpers.prependcommands(commands,...)
 insert(commands,1,push)
 for i=select("#",...),1,-1 do
  local s=(select(i,...))
  if s then
   insert(commands,1,s)
  end
 end
 insert(commands,pop)
 return commands
end
function helpers.appendcommands(commands,...)
 insert(commands,1,push)
 insert(commands,pop)
 for i=1,select("#",...) do
  local s=(select(i,...))
  if s then
   insert(commands,s)
  end
 end
 return commands
end
function helpers.prependcommandtable(commands,t)
 insert(commands,1,push)
 for i=#t,1,-1 do
  local s=t[i]
  if s then
   insert(commands,1,s)
  end
 end
 insert(commands,pop)
 return commands
end
function helpers.appendcommandtable(commands,t)
 insert(commands,1,push)
 insert(commands,pop)
 for i=1,#t do
  local s=t[i]
  if s then
   insert(commands,s)
  end
 end
 return commands
end
local char=setmetatableindex(function(t,k)
 local v={ "slot",0,k }
 t[k]=v
 return v
end)
local right=setmetatableindex(function(t,k)
 local v={ "right",k }
 t[k]=v
 return v
end)
local left=setmetatableindex(function(t,k)
 local v={ "right",-k }
 t[k]=v
 return v
end)
local down=setmetatableindex(function(t,k)
 local v={ "down",k }
 t[k]=v
 return v
end)
local up=setmetatableindex(function(t,k)
 local v={ "down",-k }
 t[k]=v
 return v
end)
helpers.commands=utilities.storage.allocate {
 char=char,
 right=right,
 left=left,
 down=down,
 up=up,
 push=push,
 pop=pop,
 dummy=dummy,
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-vfc”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otr” 91f70c1216e60227e1437b6c8dcd8647] ---

if not modules then modules={} end modules ['font-otr']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type,tonumber,rawget=next,type,tonumber,rawget
local byte,lower,char,gsub=string.byte,string.lower,string.char,string.gsub
local fullstrip=string.fullstrip
local floor,round=math.floor,math.round
local P,R,S,C,Cs,Cc,Ct,Carg,Cmt=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg,lpeg.Cmt
local lpegmatch=lpeg.match
local rshift=bit32.rshift
local setmetatableindex=table.setmetatableindex
local sortedkeys=table.sortedkeys
local sortedhash=table.sortedhash
local stripstring=string.nospaces
local utf16_to_utf8_be=utf.utf16_to_utf8_be
local report=logs.reporter("otf reader")
local report_cmap=logs.reporter("otf reader","cmap")
local trace_cmap=false  trackers.register("otf.cmap",function(v) trace_cmap=v end)
local trace_cmap_details=false  trackers.register("otf.cmap.details",function(v) trace_cmap_details=v end)
fonts=fonts or {}
local handlers=fonts.handlers or {}
fonts.handlers=handlers
local otf=handlers.otf or {}
handlers.otf=otf
local readers=otf.readers or {}
otf.readers=readers
local streamreader=utilities.files   
local streamwriter=utilities.files
readers.streamreader=streamreader
readers.streamwriter=streamwriter
local openfile=streamreader.open
local closefile=streamreader.close
local setposition=streamreader.setposition
local skipshort=streamreader.skipshort
local readbytes=streamreader.readbytes
local readstring=streamreader.readstring
local readbyte=streamreader.readcardinal1  
local readushort=streamreader.readcardinal2  
local readuint=streamreader.readcardinal3  
local readulong=streamreader.readcardinal4
local readshort=streamreader.readinteger2   
local readlong=streamreader.readinteger4   
local readfixed=streamreader.readfixed4
local read2dot14=streamreader.read2dot14  
local readfword=readshort       
local readufword=readushort      
local readoffset=readushort
local readcardinaltable=streamreader.readcardinaltable
local readintegertable=streamreader.readintegertable
function streamreader.readtag(f)
 return lower(stripstring(readstring(f,4)))
end
local short=2
local ushort=2
local ulong=4
directives.register("fonts.streamreader",function()
 streamreader=utilities.streams
 openfile=streamreader.open
 closefile=streamreader.close
 setposition=streamreader.setposition
 skipshort=streamreader.skipshort
 readbytes=streamreader.readbytes
 readstring=streamreader.readstring
 readbyte=streamreader.readcardinal1
 readushort=streamreader.readcardinal2
 readuint=streamreader.readcardinal3
 readulong=streamreader.readcardinal4
 readshort=streamreader.readinteger2
 readlong=streamreader.readinteger4
 readfixed=streamreader.readfixed4
 read2dot14=streamreader.read2dot14
 readfword=readshort
 readufword=readushort
 readoffset=readushort
 readcardinaltable=streamreader.readcardinaltable
 readintegertable=streamreader.readintegertable
 function streamreader.readtag(f)
  return lower(stripstring(readstring(f,4)))
 end
end)
local function readlongdatetime(f)
 local a,b,c,d,e,f,g,h=readbytes(f,8)
 return 0x100000000*d+0x1000000*e+0x10000*f+0x100*g+h
end
local tableversion=0.004
readers.tableversion=tableversion
local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000
local reservednames={ [0]="copyright",
 "family",
 "subfamily",
 "uniqueid",
 "fullname",
 "version",
 "postscriptname",
 "trademark",
 "manufacturer",
 "designer",
 "description",
 "vendorurl",
 "designerurl",
 "license",
 "licenseurl",
 "reserved",
 "typographicfamily",
 "typographicsubfamily",
 "compatiblefullname",
 "sampletext",
 "cidfindfontname",
 "wwsfamily",
 "wwssubfamily",
 "lightbackgroundpalette",
 "darkbackgroundpalette",
 "variationspostscriptnameprefix",
}
local platforms={ [0]="unicode",
 "macintosh",
 "iso",
 "windows",
 "custom",
}
local encodings={
 unicode={ [0]="unicode 1.0 semantics",
  "unicode 1.1 semantics",
  "iso/iec 10646",
  "unicode 2.0 bmp",
  "unicode 2.0 full",
  "unicode variation sequences",
  "unicode full repertoire",
 },
 macintosh={ [0]="roman","japanese","chinese (traditional)","korean","arabic","hebrew","greek","russian",
  "rsymbol","devanagari","gurmukhi","gujarati","oriya","bengali","tamil","telugu","kannada",
  "malayalam","sinhalese","burmese","khmer","thai","laotian","georgian","armenian",
  "chinese (simplified)","tibetan","mongolian","geez","slavic","vietnamese","sindhi",
  "uninterpreted",
 },
 iso={ [0]="7-bit ascii",
  "iso 10646",
  "iso 8859-1",
 },
 windows={ [0]="symbol",
  "unicode bmp",
  "shiftjis",
  "prc",
  "big5",
  "wansung",
  "johab",
  "reserved 7",
  "reserved 8",
  "reserved 9",
  "unicode ucs-4",
 },
 custom={
 }
}
local decoders={
 unicode={},
 macintosh={},
 iso={},
 windows={
  ["unicode semantics"]=utf16_to_utf8_be,
  ["unicode bmp"]=utf16_to_utf8_be,
  ["unicode full"]=utf16_to_utf8_be,
  ["unicode 1.0 semantics"]=utf16_to_utf8_be,
  ["unicode 1.1 semantics"]=utf16_to_utf8_be,
  ["unicode 2.0 bmp"]=utf16_to_utf8_be,
  ["unicode 2.0 full"]=utf16_to_utf8_be,
  ["unicode variation sequences"]=utf16_to_utf8_be,
  ["unicode full repertoire"]=utf16_to_utf8_be,
 },
 custom={},
}
local languages={
 unicode={
  [  0]="english",
 },
 macintosh={
  [  0]="english",
 },
 iso={},
 windows={
  [0x0409]="english - united states",
 },
 custom={},
}
local standardromanencoding={ [0]=
 "notdef",".null","nonmarkingreturn","space","exclam","quotedbl",
 "numbersign","dollar","percent","ampersand","quotesingle","parenleft",
 "parenright","asterisk","plus","comma","hyphen","period","slash",
 "zero","one","two","three","four","five","six","seven","eight",
 "nine","colon","semicolon","less","equal","greater","question","at",
 "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
 "P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft",
 "backslash","bracketright","asciicircum","underscore","grave","a","b",
 "c","d","e","f","g","h","i","j","k","l","m","n","o","p","q",
 "r","s","t","u","v","w","x","y","z","braceleft","bar",
 "braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute",
 "Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex",
 "adieresis","atilde","aring","ccedilla","eacute","egrave",
 "ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis",
 "ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute",
 "ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling",
 "section","bullet","paragraph","germandbls","registered","copyright",
 "trademark","acute","dieresis","notequal","AE","Oslash","infinity",
 "plusminus","lessequal","greaterequal","yen","mu","partialdiff",
 "summation","product","pi","integral","ordfeminine","ordmasculine",
 "Omega","ae","oslash","questiondown","exclamdown","logicalnot",
 "radical","florin","approxequal","Delta","guillemotleft",
 "guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde",
 "Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright",
 "quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis",
 "fraction","currency","guilsinglleft","guilsinglright","fi","fl",
 "daggerdbl","periodcentered","quotesinglbase","quotedblbase",
 "perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave",
 "Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex",
 "apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi",
 "circumflex","tilde","macron","breve","dotaccent","ring","cedilla",
 "hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron",
 "Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn",
 "thorn","minus","multiply","onesuperior","twosuperior","threesuperior",
 "onehalf","onequarter","threequarters","franc","Gbreve","gbreve",
 "Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron",
 "dcroat",
}
local weights={
 [100]="thin",
 [200]="extralight",
 [300]="light",
 [400]="normal",
 [500]="medium",
 [600]="semibold",
 [700]="bold",
 [800]="extrabold",
 [900]="black",
}
local widths={
 "ultracondensed",
 "extracondensed",
 "condensed",
 "semicondensed",
 "normal",
 "semiexpanded",
 "expanded",
 "extraexpanded",
 "ultraexpanded",
}
setmetatableindex(weights,function(t,k)
 local r=floor((k+50)/100)*100
 local v=(r>900 and "black") or rawget(t,r) or "normal"
 return v
end)
setmetatableindex(widths,function(t,k)
 return "normal"
end)
local panoseweights={ [0]="normal",
 "normal",
 "verylight",
 "light",
 "thin",
 "book",
 "medium",
 "demi",
 "bold",
 "heavy",
 "black",
}
local panosewidths={ [0]="normal",
 "normal",
 "normal",
 "normal",
 "normal",
 "expanded",
 "condensed",
 "veryexpanded",
 "verycondensed",
 "monospaced",
}
local helpers={}
readers.helpers=helpers
local function gotodatatable(f,fontdata,tag,criterium)
 if criterium and f then
  local tables=fontdata.tables
  if tables then
   local datatable=tables[tag]
   if datatable then
    local tableoffset=datatable.offset
    setposition(f,tableoffset)
    return tableoffset
   end
  else
   report("no tables")
  end
 end
end
local function reportskippedtable(f,fontdata,tag,criterium)
 if criterium and f then
  local tables=fontdata.tables
  if tables then
   local datatable=tables[tag]
   if datatable then
    report("loading of table %a skipped",tag)
   end
  else
   report("no tables")
  end
 end
end
local function setvariabledata(fontdata,tag,data)
 local variabledata=fontdata.variabledata
 if variabledata then
  variabledata[tag]=data
 else
  fontdata.variabledata={ [tag]=data }
 end
end
helpers.gotodatatable=gotodatatable
helpers.setvariabledata=setvariabledata
helpers.reportskippedtable=reportskippedtable
local platformnames={
 postscriptname=true,
 fullname=true,
 family=true,
 subfamily=true,
 typographicfamily=true,
 typographicsubfamily=true,
 compatiblefullname=true,
}
local platformextras={
 uniqueid=true,
 version=true,
 copyright=true,
 license=true,
 licenseurl=true,
 manufacturer=true,
 vendorurl=true,
}
function readers.name(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"name",true)
 if tableoffset then
  local format=readushort(f)
  local nofnames=readushort(f)
  local offset=readushort(f)
  local start=tableoffset+offset
  local namelists={
   unicode={},
   windows={},
   macintosh={},
  }
  for i=1,nofnames do
   local platform=platforms[readushort(f)]
   if platform then
    local namelist=namelists[platform]
    if namelist then
     local encoding=readushort(f)
     local language=readushort(f)
     local encodings=encodings[platform]
     local languages=languages[platform]
     if encodings and languages then
      local encoding=encodings[encoding]
      local language=languages[language]
      if encoding and language then
       local index=readushort(f)
       local name=reservednames[index]
       namelist[#namelist+1]={
        platform=platform,
        encoding=encoding,
        language=language,
        name=name,
        index=index,
        length=readushort(f),
        offset=start+readushort(f),
       }
      else
       skipshort(f,3)
      end
     else
      skipshort(f,3)
     end
    else
     skipshort(f,5)
    end
   else
    skipshort(f,5)
   end
  end
  local names={}
  local done={}
  local extras={}
  local function decoded(platform,encoding,content)
   local decoder=decoders[platform]
   if decoder then
    decoder=decoder[encoding]
   end
   if decoder then
    return decoder(content)
   else
    return content
   end
  end
  local function filter(platform,e,l)
   local namelist=namelists[platform]
   for i=1,#namelist do
    local name=namelist[i]
    local nametag=name.name
    local index=name.index
    if not done[nametag or i] then
     local encoding=name.encoding
     local language=name.language
     if (not e or encoding==e) and (not l or language==l) then
      setposition(f,name.offset)
      local content=decoded(platform,encoding,readstring(f,name.length))
      if nametag then
       names[nametag]={
        content=content,
        platform=platform,
        encoding=encoding,
        language=language,
       }
      end
      extras[index]=content
      done[nametag or i]=true
     end
    end
   end
  end
  filter("windows","unicode bmp","english - united states")
  filter("macintosh","roman","english")
  filter("windows")
  filter("macintosh")
  filter("unicode")
  fontdata.names=names
  fontdata.extras=extras
  if specification.platformnames then
   local collected={}
   local platformextras=specification.platformextras and platformextras
   for platform,namelist in next,namelists do
    local filtered=false
    for i=1,#namelist do
     local entry=namelist[i]
     local name=entry.name
     if platformnames[name] or (platformextras and platformextras[name]) then
      setposition(f,entry.offset)
      local content=decoded(platform,entry.encoding,readstring(f,entry.length))
      if filtered then
       filtered[name]=content
      else
       filtered={ [name]=content }
      end
     end
    end
    if filtered then
     collected[platform]=filtered
    end
   end
   fontdata.platformnames=collected
  end
 else
  fontdata.names={}
 end
end
local validutf=lpeg.patterns.validutf8
local function getname(fontdata,key)
 local names=fontdata.names
 if names then
  local value=names[key]
  if value then
   local content=value.content
   return lpegmatch(validutf,content) and content or nil
  end
 end
end
readers["os/2"]=function(f,fontdata)
 local tableoffset=gotodatatable(f,fontdata,"os/2",true)
 if tableoffset then
  local version=readushort(f)
  local windowsmetrics={
   version=version,
   averagewidth=readshort(f),
   weightclass=readushort(f),
   widthclass=readushort(f),
   fstype=readushort(f),
   subscriptxsize=readshort(f),
   subscriptysize=readshort(f),
   subscriptxoffset=readshort(f),
   subscriptyoffset=readshort(f),
   superscriptxsize=readshort(f),
   superscriptysize=readshort(f),
   superscriptxoffset=readshort(f),
   superscriptyoffset=readshort(f),
   strikeoutsize=readshort(f),
   strikeoutpos=readshort(f),
   familyclass=readshort(f),
   panose={ readbytes(f,10) },
   unicoderanges={ readulong(f),readulong(f),readulong(f),readulong(f) },
   vendor=readstring(f,4),
   fsselection=readushort(f),
   firstcharindex=readushort(f),
   lastcharindex=readushort(f),
   typoascender=readshort(f),
   typodescender=readshort(f),
   typolinegap=readshort(f),
   winascent=readushort(f),
   windescent=readushort(f),
  }
  if version>=1 then
   windowsmetrics.codepageranges={ readulong(f),readulong(f) }
  end
  if version>=2 then
   windowsmetrics.xheight=readshort(f)
   windowsmetrics.capheight=readshort(f)
   windowsmetrics.defaultchar=readushort(f)
   windowsmetrics.breakchar=readushort(f)
  end
  windowsmetrics.weight=windowsmetrics.weightclass and weights[windowsmetrics.weightclass]
  windowsmetrics.width=windowsmetrics.widthclass and  widths [windowsmetrics.widthclass]
  windowsmetrics.panoseweight=panoseweights[windowsmetrics.panose[3]]
  windowsmetrics.panosewidth=panosewidths [windowsmetrics.panose[4]]
  fontdata.windowsmetrics=windowsmetrics
 else
  fontdata.windowsmetrics={}
 end
end
readers.head=function(f,fontdata)
 local tableoffset=gotodatatable(f,fontdata,"head",true)
 if tableoffset then
  local version=readulong(f)
  local fontversion=readulong(f)
  local fontheader={
   version=version,
   fontversion=number.to16dot16(fontversion),
   fontversionnumber=fontversion,
   checksum=readushort(f)*0x10000+readushort(f),
   magic=readulong(f),
   flags=readushort(f),
   units=readushort(f),
   created=readlongdatetime(f),
   modified=readlongdatetime(f),
   xmin=readshort(f),
   ymin=readshort(f),
   xmax=readshort(f),
   ymax=readshort(f),
   macstyle=readushort(f),
   smallpixels=readushort(f),
   directionhint=readshort(f),
   indextolocformat=readshort(f),
   glyphformat=readshort(f),
  }
  fontdata.fontheader=fontheader
 else
  fontdata.fontheader={}
 end
 fontdata.nofglyphs=0
end
readers.hhea=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"hhea",specification.details)
 if tableoffset then
  fontdata.horizontalheader={
   version=readulong(f),
   ascender=readfword(f),
   descender=readfword(f),
   linegap=readfword(f),
   maxadvancewidth=readufword(f),
   minleftsidebearing=readfword(f),
   minrightsidebearing=readfword(f),
   maxextent=readfword(f),
   caretsloperise=readshort(f),
   caretsloperun=readshort(f),
   caretoffset=readshort(f),
   reserved_1=readshort(f),
   reserved_2=readshort(f),
   reserved_3=readshort(f),
   reserved_4=readshort(f),
   metricdataformat=readshort(f),
   nofmetrics=readushort(f),
  }
 else
  fontdata.horizontalheader={
   nofmetrics=0,
  }
 end
end
readers.vhea=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"vhea",specification.details)
 if tableoffset then
  fontdata.verticalheader={
   version=readulong(f),
   ascender=readfword(f),
   descender=readfword(f),
   linegap=readfword(f),
   maxadvanceheight=readufword(f),
   mintopsidebearing=readfword(f),
   minbottomsidebearing=readfword(f),
   maxextent=readfword(f),
   caretsloperise=readshort(f),
   caretsloperun=readshort(f),
   caretoffset=readshort(f),
   reserved_1=readshort(f),
   reserved_2=readshort(f),
   reserved_3=readshort(f),
   reserved_4=readshort(f),
   metricdataformat=readshort(f),
   nofmetrics=readushort(f),
  }
 else
  fontdata.verticalheader={
   nofmetrics=0,
  }
 end
end
readers.maxp=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"maxp",specification.details)
 if tableoffset then
  local version=readulong(f)
  local nofglyphs=readushort(f)
  fontdata.nofglyphs=nofglyphs
  if version==0x00005000 then
   fontdata.maximumprofile={
    version=version,
    nofglyphs=nofglyphs,
   }
  elseif version==0x00010000 then
   fontdata.maximumprofile={
    version=version,
    nofglyphs=nofglyphs,
    points=readushort(f),
    contours=readushort(f),
    compositepoints=readushort(f),
    compositecontours=readushort(f),
    zones=readushort(f),
    twilightpoints=readushort(f),
    storage=readushort(f),
    functiondefs=readushort(f),
    instructiondefs=readushort(f),
    stackelements=readushort(f),
    sizeofinstructions=readushort(f),
    componentelements=readushort(f),
    componentdepth=readushort(f),
   }
  else
   fontdata.maximumprofile={
    version=version,
    nofglyphs=0,
   }
  end
 end
end
readers.hmtx=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"hmtx",specification.glyphs)
 if tableoffset then
  local horizontalheader=fontdata.horizontalheader
  local nofmetrics=horizontalheader.nofmetrics
  local glyphs=fontdata.glyphs
  local nofglyphs=fontdata.nofglyphs
  local width=0 
  local leftsidebearing=0
  for i=0,nofmetrics-1 do
   local glyph=glyphs[i]
   width=readshort(f) 
   leftsidebearing=readshort(f)
   if width~=0 then
    glyph.width=width
   end
  end
  for i=nofmetrics,nofglyphs-1 do
   local glyph=glyphs[i]
   if width~=0 then
    glyph.width=width
   end
  end
 end
end
readers.vmtx=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"vmtx",specification.glyphs)
 if tableoffset then
  local verticalheader=fontdata.verticalheader
  local nofmetrics=verticalheader.nofmetrics
  local glyphs=fontdata.glyphs
  local nofglyphs=fontdata.nofglyphs
  local vheight=0
  local vdefault=verticalheader.ascender-verticalheader.descender
  local topsidebearing=0
  for i=0,nofmetrics-1 do
   local glyph=glyphs[i]
   vheight=readushort(f)
   topsidebearing=readshort(f)
   if vheight~=0 and vheight~=vdefault then
    glyph.vheight=vheight
   end
   if topsidebearing~=0 then
    glyph.tsb=topsidebearing
   end
  end
  for i=nofmetrics,nofglyphs-1 do
   local glyph=glyphs[i]
   if vheight~=0 and vheight~=vdefault then
    glyph.vheight=vheight
   end
  end
 end
end
readers.vorg=function(f,fontdata,specification)
 reportskippedtable(f,fontdata,"vorg",specification.glyphs)
end
readers.post=function(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"post",true)
 if tableoffset then
  local version=readulong(f)
  fontdata.postscript={
   version=version,
   italicangle=readfixed(f),
   underlineposition=readfword(f),
   underlinethickness=readfword(f),
   monospaced=readulong(f),
   minmemtype42=readulong(f),
   maxmemtype42=readulong(f),
   minmemtype1=readulong(f),
   maxmemtype1=readulong(f),
  }
  if not specification.glyphs then
  elseif version==0x00010000 then
   for index=0,#standardromanencoding do
    glyphs[index].name=standardromanencoding[index]
   end
  elseif version==0x00020000 then
   local glyphs=fontdata.glyphs
   local nofglyphs=readushort(f)
   local indices={}
   local names={}
   local maxnames=0
   for i=0,nofglyphs-1 do
    local nameindex=readushort(f)
    if nameindex>=258 then
     maxnames=maxnames+1
     nameindex=nameindex-257
     indices[nameindex]=i
    else
     glyphs[i].name=standardromanencoding[nameindex]
    end
   end
   for i=1,maxnames do
    local mapping=indices[i]
    if not mapping then
     report("quit post name fetching at %a of %a: %s",i,maxnames,"no index")
     break
    else
     local length=readbyte(f)
     if length>0 then
      glyphs[mapping].name=readstring(f,length)
     else
     end
    end
   end
  end
 else
  fontdata.postscript={}
 end
end
readers.cff=function(f,fontdata,specification)
 reportskippedtable(f,fontdata,"cff",specification.glyphs)
end
local formatreaders={}
local duplicatestoo=true
local sequence={
 { 3,1,4 },
 { 3,10,12 },
 { 0,3,4 },
 { 0,3,12 },
 { 0,1,4 },
 { 0,1,12 },
 { 0,0,6 },
 { 3,0,6 },
 { 3,0,4 },
 { 0,5,14 },
 { 0,4,12 },
 { 3,10,13 },
}
local supported={}
for i=1,#sequence do
 local si=sequence[i]
 local sp,se,sf=si[1],si[2],si[3]
 local p=supported[sp]
 if not p then
  p={}
  supported[sp]=p
 end
 local e=p[se]
 if not e then
  e={}
  p[se]=e
 end
 e[sf]=true
end
formatreaders[4]=function(f,fontdata,offset)
 setposition(f,offset+2)
 local length=readushort(f) 
 local language=readushort(f)
 local nofsegments=readushort(f)/2
 skipshort(f,3)
 local mapping=fontdata.mapping
 local glyphs=fontdata.glyphs
 local duplicates=fontdata.duplicates
 local nofdone=0
 local endchars=readcardinaltable(f,nofsegments,ushort)
 local reserved=readushort(f) 
 local startchars=readcardinaltable(f,nofsegments,ushort)
 local deltas=readcardinaltable(f,nofsegments,ushort)
 local offsets=readcardinaltable(f,nofsegments,ushort)
 local size=(length-2*2-5*2-4*2*nofsegments)/2
 local indices=readcardinaltable(f,size-1,ushort)
 for segment=1,nofsegments do
  local startchar=startchars[segment]
  local endchar=endchars[segment]
  local offset=offsets[segment]
  local delta=deltas[segment]
  if startchar==0xFFFF and endchar==0xFFFF then
  elseif startchar==0xFFFF and offset==0 then
  elseif offset==0xFFFF then
  elseif offset==0 then
   if trace_cmap_details then
    report("format 4.%i segment %2i from %C upto %C at index %H",1,segment,startchar,endchar,(startchar+delta)%65536)
   end
   for unicode=startchar,endchar do
    local index=(unicode+delta)%65536
    if index and index>0 then
     local glyph=glyphs[index]
     if glyph then
      local gu=glyph.unicode
      if not gu then
       glyph.unicode=unicode
       nofdone=nofdone+1
      elseif gu~=unicode then
       if duplicatestoo then
        local d=duplicates[gu]
        if d then
         d[unicode]=true
        else
         duplicates[gu]={ [unicode]=true }
        end
       else
        report("duplicate case 1: %C %04i %s",unicode,index,glyphs[index].name)
       end
      end
      if not mapping[index] then
       mapping[index]=unicode
      end
     end
    end
   end
  else
   local shift=(segment-nofsegments+offset/2)-startchar
   if trace_cmap_details then
    report_cmap("format 4.%i segment %2i from %C upto %C at index %H",0,segment,startchar,endchar,(startchar+delta)%65536)
   end
   for unicode=startchar,endchar do
    local slot=shift+unicode
    local index=indices[slot]
    if index and index>0 then
     index=(index+delta)%65536
     local glyph=glyphs[index]
     if glyph then
      local gu=glyph.unicode
      if not gu then
       glyph.unicode=unicode
       nofdone=nofdone+1
      elseif gu~=unicode then
       if duplicatestoo then
        local d=duplicates[gu]
        if d then
         d[unicode]=true
        else
         duplicates[gu]={ [unicode]=true }
        end
       else
        report("duplicate case 2: %C %04i %s",unicode,index,glyphs[index].name)
       end
      end
      if not mapping[index] then
       mapping[index]=unicode
      end
     end
    end
   end
  end
 end
 return nofdone
end
formatreaders[6]=function(f,fontdata,offset)
 setposition(f,offset) 
 local format=readushort(f)
 local length=readushort(f)
 local language=readushort(f)
 local mapping=fontdata.mapping
 local glyphs=fontdata.glyphs
 local duplicates=fontdata.duplicates
 local start=readushort(f)
 local count=readushort(f)
 local stop=start+count-1
 local nofdone=0
 if trace_cmap_details then
  report_cmap("format 6 from %C to %C",2,start,stop)
 end
 for unicode=start,stop do
  local index=readushort(f)
  if index>0 then
   local glyph=glyphs[index]
   if glyph then
    local gu=glyph.unicode
    if not gu then
     glyph.unicode=unicode
     nofdone=nofdone+1
    elseif gu~=unicode then
    end
    if not mapping[index] then
     mapping[index]=unicode
    end
   end
  end
 end
 return nofdone
end
formatreaders[12]=function(f,fontdata,offset)
 setposition(f,offset+2+2+4+4) 
 local mapping=fontdata.mapping
 local glyphs=fontdata.glyphs
 local duplicates=fontdata.duplicates
 local nofgroups=readulong(f)
 local nofdone=0
 for i=1,nofgroups do
  local first=readulong(f)
  local last=readulong(f)
  local index=readulong(f)
  if trace_cmap_details then
   report_cmap("format 12 from %C to %C starts at index %i",first,last,index)
  end
  for unicode=first,last do
   local glyph=glyphs[index]
   if glyph then
    local gu=glyph.unicode
    if not gu then
     glyph.unicode=unicode
     nofdone=nofdone+1
    elseif gu~=unicode then
     local d=duplicates[gu]
     if d then
      d[unicode]=true
     else
      duplicates[gu]={ [unicode]=true }
     end
    end
    if not mapping[index] then
     mapping[index]=unicode
    end
   end
   index=index+1
  end
 end
 return nofdone
end
formatreaders[13]=function(f,fontdata,offset)
 setposition(f,offset+2+2+4+4) 
 local mapping=fontdata.mapping
 local glyphs=fontdata.glyphs
 local duplicates=fontdata.duplicates
 local nofgroups=readulong(f)
 local nofdone=0
 for i=1,nofgroups do
  local first=readulong(f)
  local last=readulong(f)
  local index=readulong(f)
  if first<privateoffset then
   if trace_cmap_details then
    report_cmap("format 13 from %C to %C get index %i",first,last,index)
   end
   local glyph=glyphs[index]
   local unicode=glyph.unicode
   if not unicode then
    unicode=first
    glyph.unicode=unicode
    first=first+1
   end
   local list=duplicates[unicode]
   mapping[index]=unicode
   if not list then
    list={}
    duplicates[unicode]=list
   end
   if last>=privateoffset then
    local limit=privateoffset-1
    report("format 13 from %C to %C pruned to %C",first,last,limit)
    last=limit
   end
   for unicode=first,last do
    list[unicode]=true
   end
   nofdone=nofdone+last-first+1
  else
   report("format 13 from %C to %C ignored",first,last)
  end
 end
 return nofdone
end
formatreaders[14]=function(f,fontdata,offset)
 if offset and offset~=0 then
  setposition(f,offset)
  local format=readushort(f)
  local length=readulong(f)
  local nofrecords=readulong(f)
  local records={}
  local variants={}
  local nofdone=0
  fontdata.variants=variants
  for i=1,nofrecords do
   records[i]={
    selector=readuint(f),
    default=readulong(f),
    other=readulong(f),
   }
  end
  for i=1,nofrecords do
   local record=records[i]
   local selector=record.selector
   local default=record.default
   local other=record.other
   local other=record.other
   if other~=0 then
    setposition(f,offset+other)
    local mapping={}
    local count=readulong(f)
    for i=1,count do
     mapping[readuint(f)]=readushort(f)
    end
    nofdone=nofdone+count
    variants[selector]=mapping
   end
  end
  return nofdone
 else
  return 0
 end
end
local function checkcmap(f,fontdata,records,platform,encoding,format)
 local pdata=records[platform]
 if not pdata then
  if trace_cmap_details then
   report_cmap("skipped, %s, p=%i e=%i f=%i","no platform",platform,encoding,format)
  end
  return 0
 end
 local edata=pdata[encoding]
 if not edata then
  if trace_cmap_details then
   report_cmap("skipped, %s, p=%i e=%i f=%i","no encoding",platform,encoding,format)
  end
  return 0
 end
 local fdata=edata[format]
 if not fdata then
  if trace_cmap_details then
   report_cmap("skipped, %s, p=%i e=%i f=%i","no format",platform,encoding,format)
  end
  return 0
 elseif type(fdata)~="number" then
  if trace_cmap_details then
   report_cmap("skipped, %s, p=%i e=%i f=%i","already done",platform,encoding,format)
  end
  return 0
 end
 edata[format]=true 
 local reader=formatreaders[format]
 if not reader then
  if trace_cmap_details then
   report_cmap("skipped, %s, p=%i e=%i f=%i","unsupported format",platform,encoding,format)
  end
  return 0
 end
 local n=reader(f,fontdata,fdata) or 0
 if trace_cmap_details or trace_cmap then
  local p=platforms[platform]
  local e=encodings[p]
  report_cmap("checked, platform %i (%s), encoding %i (%s), format %i, new unicodes %i",
   platform,p,encoding,e and e[encoding] or "?",format,n)
 end
 return n
end
function readers.cmap(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"cmap",specification.glyphs)
 if tableoffset then
  local version=readushort(f)
  local noftables=readushort(f)
  local records={}
  local unicodecid=false
  local variantcid=false
  local variants={}
  local duplicates=fontdata.duplicates or {}
  fontdata.duplicates=duplicates
  for i=1,noftables do
   local platform=readushort(f)
   local encoding=readushort(f)
   local offset=readulong(f)
   local record=records[platform]
   if not record then
    records[platform]={
     [encoding]={
      offsets={ offset },
      formats={},
     }
    }
   else
    local subtables=record[encoding]
    if not subtables then
     record[encoding]={
      offsets={ offset },
      formats={},
     }
    else
     local offsets=subtables.offsets
     offsets[#offsets+1]=offset
    end
   end
  end
  if trace_cmap then
   report("found cmaps:")
  end
  for platform,record in sortedhash(records) do
   local p=platforms[platform]
   local e=encodings[p]
   local sp=supported[platform]
   local ps=p or "?"
   if trace_cmap then
    if sp then
     report("  platform %i: %s",platform,ps)
    else
     report("  platform %i: %s (unsupported)",platform,ps)
    end
   end
   for encoding,subtables in sortedhash(record) do
    local se=sp and sp[encoding]
    local es=e and e[encoding] or "?"
    if trace_cmap then
     if se then
      report("    encoding %i: %s",encoding,es)
     else
      report("    encoding %i: %s (unsupported)",encoding,es)
     end
    end
    local offsets=subtables.offsets
    local formats=subtables.formats
    for i=1,#offsets do
     local offset=tableoffset+offsets[i]
     setposition(f,offset)
     formats[readushort(f)]=offset
    end
    record[encoding]=formats
    if trace_cmap then
     local list=sortedkeys(formats)
     for i=1,#list do
      if not (se and se[list[i]]) then
       list[i]=list[i].." (unsupported)"
      end
     end
     report("      formats: % t",list)
    end
   end
  end
  local ok=false
  for i=1,#sequence do
   local si=sequence[i]
   local sp,se,sf=si[1],si[2],si[3]
   if checkcmap(f,fontdata,records,sp,se,sf)>0 then
    ok=true
   end
  end
  if not ok then
   report("no useable unicode cmap found")
  end
  fontdata.cidmaps={
   version=version,
   noftables=noftables,
   records=records,
  }
 else
  fontdata.cidmaps={}
 end
end
function readers.loca(f,fontdata,specification)
 reportskippedtable(f,fontdata,"loca",specification.glyphs)
end
function readers.glyf(f,fontdata,specification) 
 reportskippedtable(f,fontdata,"glyf",specification.glyphs)
end
function readers.colr(f,fontdata,specification)
 reportskippedtable(f,fontdata,"colr",specification.glyphs)
end
function readers.cpal(f,fontdata,specification)
 reportskippedtable(f,fontdata,"cpal",specification.glyphs)
end
function readers.svg(f,fontdata,specification)
 reportskippedtable(f,fontdata,"svg",specification.glyphs)
end
function readers.sbix(f,fontdata,specification)
 reportskippedtable(f,fontdata,"sbix",specification.glyphs)
end
function readers.cbdt(f,fontdata,specification)
 reportskippedtable(f,fontdata,"cbdt",specification.glyphs)
end
function readers.cblc(f,fontdata,specification)
 reportskippedtable(f,fontdata,"cblc",specification.glyphs)
end
function readers.ebdt(f,fontdata,specification)
 reportskippedtable(f,fontdata,"ebdt",specification.glyphs)
end
function readers.ebsc(f,fontdata,specification)
 reportskippedtable(f,fontdata,"ebsc",specification.glyphs)
end
function readers.eblc(f,fontdata,specification)
 reportskippedtable(f,fontdata,"eblc",specification.glyphs)
end
function readers.kern(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"kern",specification.kerns)
 if tableoffset then
  local version=readushort(f)
  local noftables=readushort(f)
  for i=1,noftables do
   local version=readushort(f)
   local length=readushort(f)
   local coverage=readushort(f)
   local format=rshift(coverage,8) 
   if format==0 then
    local nofpairs=readushort(f)
    local searchrange=readushort(f)
    local entryselector=readushort(f)
    local rangeshift=readushort(f)
    local kerns={}
    local glyphs=fontdata.glyphs
    for i=1,nofpairs do
     local left=readushort(f)
     local right=readushort(f)
     local kern=readfword(f)
     local glyph=glyphs[left]
     local kerns=glyph.kerns
     if kerns then
      kerns[right]=kern
     else
      glyph.kerns={ [right]=kern }
     end
    end
   elseif format==2 then
    report("todo: kern classes")
   else
    report("todo: kerns")
   end
  end
 end
end
function readers.gdef(f,fontdata,specification)
 reportskippedtable(f,fontdata,"gdef",specification.details)
end
function readers.gsub(f,fontdata,specification)
 reportskippedtable(f,fontdata,"gsub",specification.details)
end
function readers.gpos(f,fontdata,specification)
 reportskippedtable(f,fontdata,"gpos",specification.details)
end
function readers.math(f,fontdata,specification)
 reportskippedtable(f,fontdata,"math",specification.details)
end
local function getinfo(maindata,sub,platformnames,rawfamilynames,metricstoo,instancenames)
 local fontdata=sub and maindata.subfonts and maindata.subfonts[sub] or maindata
 local names=fontdata.names
 local info=nil
 if names then
  local metrics=fontdata.windowsmetrics or {}
  local postscript=fontdata.postscript  or {}
  local fontheader=fontdata.fontheader  or {}
  local cffinfo=fontdata.cffinfo  or {}
  local verticalheader=fontdata.verticalheader or {}
  local filename=fontdata.filename
  local weight=getname(fontdata,"weight") or (cffinfo and cffinfo.weight) or (metrics and metrics.weight)
  local width=getname(fontdata,"width")  or (cffinfo and cffinfo.width ) or (metrics and metrics.width )
  local fontname=getname(fontdata,"postscriptname")
  local fullname=getname(fontdata,"fullname")
  local family=getname(fontdata,"family")
  local subfamily=getname(fontdata,"subfamily")
  local familyname=getname(fontdata,"typographicfamily")
  local subfamilyname=getname(fontdata,"typographicsubfamily")
  local compatiblename=getname(fontdata,"compatiblefullname") 
  if rawfamilynames then
  else
   if not familyname then familyname=family end
   if not subfamilyname then subfamilyname=subfamily end
  end
  if platformnames then
   platformnames=fontdata.platformnames
  end
  if instancenames then
   local variabledata=fontdata.variabledata
   if variabledata then
    local instances=variabledata and variabledata.instances
    if instances then
     instancenames={}
     for i=1,#instances do
      instancenames[i]=lower(stripstring(instances[i].subfamily))
     end
    else
     instancenames=nil
    end
   else
    instancenames=nil
   end
  end
  info={ 
   subfontindex=fontdata.subfontindex or sub or 0,
   version=getname(fontdata,"version"),
   fontname=fontname,
   fullname=fullname,
   family=family,
   subfamily=subfamily,
   familyname=familyname,
   subfamilyname=subfamilyname,
   compatiblename=compatiblename,
   weight=weight and lower(weight),
   width=width and lower(width),
   pfmweight=metrics.weightclass or 400,
   pfmwidth=metrics.widthclass or 5,
   panosewidth=metrics.panosewidth,
   panoseweight=metrics.panoseweight,
   fstype=metrics.fstype or 0,
   italicangle=postscript.italicangle or 0,
   units=fontheader.units or 0,
   designsize=fontdata.designsize,
   minsize=fontdata.minsize,
   maxsize=fontdata.maxsize,
   boundingbox=fontheader and { fontheader.xmin or 0,fontheader.ymin or 0,fontheader.xmax or 0,fontheader.ymax or 0 } or nil,
   monospaced=(tonumber(postscript.monospaced or 0)>0) or metrics.panosewidth=="monospaced",
   averagewidth=metrics.averagewidth,
   xheight=metrics.xheight,
   capheight=metrics.capheight or fontdata.maxy,
   ascender=metrics.typoascender,
   descender=metrics.typodescender,
   platformnames=platformnames or nil,
   instancenames=instancenames or nil,
   tableoffsets=fontdata.tableoffsets,
   defaultvheight=(verticalheader.ascender or 0)-(verticalheader.descender or 0)
  }
  if metricstoo then
   local keys={
    "version",
    "ascender","descender","linegap",
    "maxadvancewidth","maxadvanceheight","maxextent",
    "minbottomsidebearing","mintopsidebearing",
   }
   local h=fontdata.horizontalheader or {}
   local v=fontdata.verticalheader   or {}
   if h then
    local th={}
    local tv={}
    for i=1,#keys do
     local key=keys[i]
     th[key]=h[key] or 0
     tv[key]=v[key] or 0
    end
    info.horizontalmetrics=th
    info.verticalmetrics=tv
   end
  end
 elseif n then
  info={
   filename=fontdata.filename,
   comment="there is no info for subfont "..n,
  }
 else
  info={
   filename=fontdata.filename,
   comment="there is no info",
  }
 end
 return info
end
local function loadtables(f,specification,offset)
 if offset then
  setposition(f,offset)
 end
 local tables={}
 local basename=file.basename(specification.filename)
 local filesize=specification.filesize
 local filetime=specification.filetime
 local fontdata={ 
  filename=basename,
  filesize=filesize,
  filetime=filetime,
  version=readstring(f,4),
  noftables=readushort(f),
  searchrange=readushort(f),
  entryselector=readushort(f),
  rangeshift=readushort(f),
  tables=tables,
  foundtables=false,
 }
 for i=1,fontdata.noftables do
  local tag=lower(stripstring(readstring(f,4)))
  local checksum=readushort(f)*0x10000+readushort(f)
  local offset=readulong(f)
  local length=readulong(f)
  if offset+length>filesize then
   report("bad %a table in file %a",tag,basename)
  end
  tables[tag]={
   checksum=checksum,
   offset=offset,
   length=length,
  }
 end
 fontdata.foundtables=sortedkeys(tables)
 if tables.cff or tables.cff2 then
  fontdata.format="opentype"
 else
  fontdata.format="truetype"
 end
 return fontdata,tables
end
local function prepareglyps(fontdata)
 local glyphs=setmetatableindex(function(t,k)
  local v={
   index=k,
  }
  t[k]=v
  return v
 end)
 fontdata.glyphs=glyphs
 fontdata.mapping={}
end
local function readtable(tag,f,fontdata,specification,...)
 local reader=readers[tag]
 if reader then
  reader(f,fontdata,specification,...)
 end
end
local function readdata(f,offset,specification)
 local fontdata,tables=loadtables(f,specification,offset)
 if specification.glyphs then
  prepareglyps(fontdata)
 end
 fontdata.temporary={}
 readtable("name",f,fontdata,specification)
 local askedname=specification.askedname
 if askedname then
  local fullname=getname(fontdata,"fullname") or ""
  local cleanname=gsub(askedname,"[^a-zA-Z0-9]","")
  local foundname=gsub(fullname,"[^a-zA-Z0-9]","")
  if lower(cleanname)~=lower(foundname) then
   return 
  end
 end
 readtable("stat",f,fontdata,specification)
 readtable("avar",f,fontdata,specification)
 readtable("fvar",f,fontdata,specification)
 local variabledata=fontdata.variabledata
 if variabledata then
  local instances=variabledata.instances
  local axis=variabledata.axis
  if axis and (not instances or #instances==0) then
   instances={}
   variabledata.instances=instances
   local function add(n,subfamily,value)
    local values={}
    for i=1,#axis do
     local a=axis[i]
     values[i]={
      axis=a.tag,
      value=i==n and value or a.default,
     }
    end
    instances[#instances+1]={
     subfamily=subfamily,
     values=values,
    }
   end
   for i=1,#axis do
    local a=axis[i]
    local tag=a.tag
    add(i,"default"..tag,a.default)
    add(i,"minimum"..tag,a.minimum)
    add(i,"maximum"..tag,a.maximum)
   end
  end
 end
 if not specification.factors then
  local instance=specification.instance
  if type(instance)=="string" then
   local factors=helpers.getfactors(fontdata,instance)
   if factors then
    specification.factors=factors
    fontdata.factors=factors
    fontdata.instance=instance
    report("user instance: %s, factors: % t",instance,factors)
   else
    report("user instance: %s, bad factors",instance)
   end
  end
 end
 if not fontdata.factors then
  if fontdata.variabledata then
   local factors=helpers.getfactors(fontdata,true)
   if factors then
    specification.factors=factors
    fontdata.factors=factors
   end
  else
  end
 end
 readtable("os/2",f,fontdata,specification)
 readtable("head",f,fontdata,specification)
 readtable("maxp",f,fontdata,specification)
 readtable("hhea",f,fontdata,specification)
 readtable("vhea",f,fontdata,specification)
 readtable("hmtx",f,fontdata,specification)
 readtable("vmtx",f,fontdata,specification)
 readtable("vorg",f,fontdata,specification)
 readtable("post",f,fontdata,specification)
 readtable("mvar",f,fontdata,specification)
 readtable("hvar",f,fontdata,specification)
 readtable("vvar",f,fontdata,specification)
 readtable("gdef",f,fontdata,specification)
 readtable("cff",f,fontdata,specification)
 readtable("cff2",f,fontdata,specification)
 readtable("cmap",f,fontdata,specification)
 readtable("loca",f,fontdata,specification) 
 readtable("glyf",f,fontdata,specification) 
 readtable("colr",f,fontdata,specification)
 readtable("cpal",f,fontdata,specification)
 readtable("svg",f,fontdata,specification)
 readtable("sbix",f,fontdata,specification)
 readtable("cbdt",f,fontdata,specification)
 readtable("cblc",f,fontdata,specification)
 readtable("ebdt",f,fontdata,specification)
 readtable("eblc",f,fontdata,specification)
 readtable("kern",f,fontdata,specification)
 readtable("gsub",f,fontdata,specification)
 readtable("gpos",f,fontdata,specification)
 readtable("math",f,fontdata,specification)
 fontdata.locations=nil
 fontdata.cidmaps=nil
 fontdata.dictionaries=nil
 if specification.tableoffsets then
  fontdata.tableoffsets=tables
  setmetatableindex(tables,{
   version=fontdata.version,
   noftables=fontdata.noftables,
   searchrange=fontdata.searchrange,
   entryselector=fontdata.entryselector,
   rangeshift=fontdata.rangeshift,
  })
 end
 return fontdata
end
local function loadfontdata(specification)
 local filename=specification.filename
 local fileattr=lfs.attributes(filename)
 local filesize=fileattr and fileattr.size or 0
 local filetime=fileattr and fileattr.modification or 0
 local f=openfile(filename,true) 
 if not f then
  report("unable to open %a",filename)
 elseif filesize==0 then
  report("empty file %a",filename)
  closefile(f)
 else
  specification.filesize=filesize
  specification.filetime=filetime
  local version=readstring(f,4)
  local fontdata=nil
  if version=="OTTO" or version=="true" or version=="\0\1\0\0" then
   fontdata=readdata(f,0,specification)
  elseif version=="ttcf" then
   local subfont=tonumber(specification.subfont)
   local ttcversion=readulong(f)
   local nofsubfonts=readulong(f)
   local offsets=readcardinaltable(f,nofsubfonts,ulong)
   if subfont then 
    if subfont>=1 and subfont<=nofsubfonts then
     fontdata=readdata(f,offsets[subfont],specification)
    else
     report("no subfont %a in file %a",subfont,filename)
    end
   else
    subfont=specification.subfont
    if type(subfont)=="string" and subfont~="" then
     specification.askedname=subfont
     for i=1,nofsubfonts do
      fontdata=readdata(f,offsets[i],specification)
      if fontdata then
       fontdata.subfontindex=i
       report("subfont named %a has index %a",subfont,i)
       break
      end
     end
     if not fontdata then
      report("no subfont named %a",subfont)
     end
    else
     local subfonts={}
     fontdata={
      filename=filename,
      filesize=filesize,
      filetime=filetime,
      version=version,
      subfonts=subfonts,
      ttcversion=ttcversion,
      nofsubfonts=nofsubfonts,
     }
     for i=1,nofsubfonts do
      subfonts[i]=readdata(f,offsets[i],specification)
     end
    end
   end
  else
   report("unknown version %a in file %a",version,filename)
  end
  closefile(f)
  return fontdata or {}
 end
end
local function loadfont(specification,n,instance)
 if type(specification)=="string" then
  specification={
   filename=specification,
   info=true,
   details=true,
   glyphs=true,
   shapes=true,
   kerns=true,
   variable=true,
   globalkerns=true,
   lookups=true,
   subfont=n or true,
   tounicode=false,
   instance=instance
  }
 end
 if specification.shapes or specification.lookups or specification.kerns then
  specification.glyphs=true
 end
 if specification.glyphs then
  specification.details=true
 end
 if specification.details then
  specification.info=true 
 end
 if specification.platformnames then
  specification.platformnames=true 
 end
 if specification.instance or instance then
  specification.variable=true
  specification.instance=specification.instance or instance
 end
 local function message(str)
  report("fatal error in file %a: %s\n%s",specification.filename,str,debug and debug.traceback())
 end
 local ok,result=xpcall(loadfontdata,message,specification)
 if ok then
  return result
 end
end
function readers.loadshapes(filename,n,instance,streams)
 local fontdata=loadfont {
  filename=filename,
  shapes=true,
  streams=streams,
  variable=true,
  subfont=n,
  instance=instance,
 }
 if fontdata then
  for k,v in next,fontdata.glyphs do
   v.class=nil
   v.index=nil
   v.math=nil
  end
  local names=fontdata.names
  if names then
   for k,v in next,names do
    names[k]=fullstrip(v.content)
   end
  end
 end
 return fontdata and {
  filename=filename,
  format=fontdata.format,
  glyphs=fontdata.glyphs,
  units=fontdata.fontheader.units,
  cffinfo=fontdata.cffinfo,
  fontheader=fontdata.fontheader,
  horizontalheader=fontdata.horizontalheader,
  verticalheader=fontdata.verticalheader,
  maximumprofile=fontdata.maximumprofile,
  names=fontdata.names,
  postscript=fontdata.postscript,
 } or {
  filename=filename,
  format="unknown",
  glyphs={},
  units=0,
 }
end
function readers.loadfont(filename,n,instance)
 local fontdata=loadfont {
  filename=filename,
  glyphs=true,
  shapes=false,
  lookups=true,
  variable=true,
  subfont=n,
  instance=instance,
 }
 if fontdata then
  return {
   tableversion=tableversion,
   creator="context mkiv",
   size=fontdata.filesize,
   time=fontdata.filetime,
   glyphs=fontdata.glyphs,
   descriptions=fontdata.descriptions,
   format=fontdata.format,
   goodies={},
   metadata=getinfo(fontdata,n,false,false,true,true),
   properties={
    hasitalics=fontdata.hasitalics or false,
    maxcolorclass=fontdata.maxcolorclass,
    hascolor=fontdata.hascolor or false,
    instance=fontdata.instance,
    factors=fontdata.factors,
    nofsubfonts=fontdata.subfonts and #fontdata.subfonts or nil,
   },
   resources={
    filename=filename,
    private=privateoffset,
    duplicates=fontdata.duplicates  or {},
    features=fontdata.features or {},
    sublookups=fontdata.sublookups  or {},
    marks=fontdata.marks    or {},
    markclasses=fontdata.markclasses or {},
    marksets=fontdata.marksets or {},
    sequences=fontdata.sequences   or {},
    variants=fontdata.variants,
    version=getname(fontdata,"version"),
    cidinfo=fontdata.cidinfo,
    mathconstants=fontdata.mathconstants,
    colorpalettes=fontdata.colorpalettes,
    svgshapes=fontdata.svgshapes,
    pngshapes=fontdata.pngshapes,
    variabledata=fontdata.variabledata,
    foundtables=fontdata.foundtables,
   },
  }
 end
end
function readers.getinfo(filename,specification)
 local subfont=nil
 local platformnames=false
 local rawfamilynames=false
 local instancenames=true
 local tableoffsets=false
 if type(specification)=="table" then
  subfont=tonumber(specification.subfont)
  platformnames=specification.platformnames
  rawfamilynames=specification.rawfamilynames
  tableoffsets=specification.tableoffsets
 else
  subfont=tonumber(specification)
 end
 local fontdata=loadfont {
  filename=filename,
  details=true,
  platformnames=platformnames,
  instancenames=true,
  tableoffsets=tableoffsets,
 }
 if fontdata then
  local subfonts=fontdata.subfonts
  if not subfonts then
   return getinfo(fontdata,nil,platformnames,rawfamilynames,false,instancenames)
  elseif not subfont then
   local info={}
   for i=1,#subfonts do
    info[i]=getinfo(fontdata,i,platformnames,rawfamilynames,false,instancenames)
   end
   return info
  elseif subfont>=1 and subfont<=#subfonts then
   return getinfo(fontdata,subfont,platformnames,rawfamilynames,false,instancenames)
  else
   return {
    filename=filename,
    comment="there is no subfont "..subfont.." in this file"
   }
  end
 else
  return {
   filename=filename,
   comment="the file cannot be opened for reading",
  }
 end
end
function readers.rehash(fontdata,hashmethod)
 report("the %a helper is not yet implemented","rehash")
end
function readers.checkhash(fontdata)
 report("the %a helper is not yet implemented","checkhash")
end
function readers.pack(fontdata,hashmethod)
 report("the %a helper is not yet implemented","pack")
end
function readers.unpack(fontdata)
 report("the %a helper is not yet implemented","unpack")
end
function readers.expand(fontdata)
 report("the %a helper is not yet implemented","unpack")
end
function readers.compact(fontdata)
 report("the %a helper is not yet implemented","compact")
end
function readers.condense(fontdata)
 report("the %a helper is not yet implemented","condense")
end
local extenders={}
function readers.registerextender(extender)
 extenders[#extenders+1]=extender
end
function readers.extend(fontdata)
 for i=1,#extenders do
  local extender=extenders[i]
  local name=extender.name or "unknown"
  local action=extender.action
  if action then
   action(fontdata)
  end
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otr”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oti” 309a75f9c14b77d87e94eba827dc4e71] ---

if not modules then modules={} end modules ['font-oti']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local lower=string.lower
local fonts=fonts
local constructors=fonts.constructors
local otf=constructors.handlers.otf
local otffeatures=constructors.features.otf
local registerotffeature=otffeatures.register
local otftables=otf.tables or {}
otf.tables=otftables
local allocate=utilities.storage.allocate
registerotffeature {
 name="features",
 description="initialization of feature handler",
 default=true,
}
local function setmode(tfmdata,value)
 if value then
  tfmdata.properties.mode=lower(value)
 end
end
otf.modeinitializer=setmode
local function setlanguage(tfmdata,value)
 if value then
  local cleanvalue=lower(value)
  local languages=otftables and otftables.languages
  local properties=tfmdata.properties
  if not languages then
   properties.language=cleanvalue
  elseif languages[value] then
   properties.language=cleanvalue
  else
   properties.language="dflt"
  end
 end
end
local function setscript(tfmdata,value)
 if value then
  local cleanvalue=lower(value)
  local scripts=otftables and otftables.scripts
  local properties=tfmdata.properties
  if not scripts then
   properties.script=cleanvalue
  elseif scripts[value] then
   properties.script=cleanvalue
  else
   properties.script="dflt"
  end
 end
end
registerotffeature {
 name="mode",
 description="mode",
 initializers={
  base=setmode,
  node=setmode,
  plug=setmode,
 }
}
registerotffeature {
 name="language",
 description="language",
 initializers={
  base=setlanguage,
  node=setlanguage,
  plug=setlanguage,
 }
}
registerotffeature {
 name="script",
 description="script",
 initializers={
  base=setscript,
  node=setscript,
  plug=setscript,
 }
}
otftables.featuretypes=allocate {
 gpos_single="position",
 gpos_pair="position",
 gpos_cursive="position",
 gpos_mark2base="position",
 gpos_mark2ligature="position",
 gpos_mark2mark="position",
 gpos_context="position",
 gpos_contextchain="position",
 gsub_single="substitution",
 gsub_multiple="substitution",
 gsub_alternate="substitution",
 gsub_ligature="substitution",
 gsub_context="substitution",
 gsub_contextchain="substitution",
 gsub_reversecontextchain="substitution",
 gsub_reversesub="substitution",
}
function otffeatures.checkeddefaultscript(featuretype,autoscript,scripts)
 if featuretype=="position" then
  local default=scripts.dflt
  if default then
   if autoscript=="position" or autoscript==true then
    return default
   else
    report_otf("script feature %s not applied, enable default positioning")
   end
  else
  end
 elseif featuretype=="substitution" then
  local default=scripts.dflt
  if default then
   if autoscript=="substitution" or autoscript==true then
    return default
   end
  end
 end
end
function otffeatures.checkeddefaultlanguage(featuretype,autolanguage,languages)
 if featuretype=="position" then
  local default=languages.dflt
  if default then
   if autolanguage=="position" or autolanguage==true then
    return default
   else
    report_otf("language feature %s not applied, enable default positioning")
   end
  else
  end
 elseif featuretype=="substitution" then
  local default=languages.dflt
  if default then
   if autolanguage=="substitution" or autolanguage==true then
    return default
   end
  end
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oti”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ott” 3f67b1b1d40bbc222681d8db4aff0f42] ---

if not modules then modules={} end modules ["font-ott"]={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files",
}
local type,next,tonumber,tostring,rawget,rawset=type,next,tonumber,tostring,rawget,rawset
local gsub,lower,format,match,gmatch,find=string.gsub,string.lower,string.format,string.match,string.gmatch,string.find
local sequenced=table.sequenced
local is_boolean=string.is_boolean
local setmetatableindex=table.setmetatableindex
local setmetatablenewindex=table.setmetatablenewindex
local allocate=utilities.storage.allocate
local fonts=fonts
local otf=fonts.handlers.otf
local otffeatures=otf.features
local tables=otf.tables or {}
otf.tables=tables
local statistics=otf.statistics or {}
otf.statistics=statistics
local scripts=allocate {
 ["adlm"]="adlam",
 ["aghb"]="caucasian albanian",
 ["ahom"]="ahom",
 ["arab"]="arabic",
 ["armi"]="imperial aramaic",
 ["armn"]="armenian",
 ["avst"]="avestan",
 ["bali"]="balinese",
 ["bamu"]="bamum",
 ["bass"]="bassa vah",
 ["batk"]="batak",
 ["beng"]="bengali",
 ["bhks"]="bhaiksuki",
 ["bng2"]="bengali variant 2",
 ["bopo"]="bopomofo",
 ["brah"]="brahmi",
 ["brai"]="braille",
 ["bugi"]="buginese",
 ["buhd"]="buhid",
 ["byzm"]="byzantine music",
 ["cakm"]="chakma",
 ["cans"]="canadian syllabics",
 ["cari"]="carian",
 ["cham"]="cham",
 ["cher"]="cherokee",
 ["copt"]="coptic",
 ["cprt"]="cypriot syllabary",
 ["cyrl"]="cyrillic",
 ["dev2"]="devanagari variant 2",
 ["deva"]="devanagari",
 ["dogr"]="dogra",
 ["dsrt"]="deseret",
 ["dupl"]="duployan",
 ["egyp"]="egyptian heiroglyphs",
 ["elba"]="elbasan",
 ["ethi"]="ethiopic",
 ["geor"]="georgian",
 ["gjr2"]="gujarati variant 2",
 ["glag"]="glagolitic",
 ["gong"]="gunjala gondi",
 ["gonm"]="masaram gondi",
 ["goth"]="gothic",
 ["gran"]="grantha",
 ["grek"]="greek",
 ["gujr"]="gujarati",
 ["gur2"]="gurmukhi variant 2",
 ["guru"]="gurmukhi",
 ["hang"]="hangul",
 ["hani"]="cjk ideographic",
 ["hano"]="hanunoo",
 ["hatr"]="hatran",
 ["hebr"]="hebrew",
 ["hluw"]="anatolian hieroglyphs",
 ["hmng"]="pahawh hmong",
 ["hung"]="old hungarian",
 ["ital"]="old italic",
 ["jamo"]="hangul jamo",
 ["java"]="javanese",
 ["kali"]="kayah li",
 ["kana"]="hiragana and katakana",
 ["khar"]="kharosthi",
 ["khmr"]="khmer",
 ["khoj"]="khojki",
 ["knd2"]="kannada variant 2",
 ["knda"]="kannada",
 ["kthi"]="kaithi",
 ["lana"]="tai tham",
 ["lao" ]="lao",
 ["latn"]="latin",
 ["lepc"]="lepcha",
 ["limb"]="limbu",
 ["lina"]="linear a",
 ["linb"]="linear b",
 ["lisu"]="lisu",
 ["lyci"]="lycian",
 ["lydi"]="lydian",
 ["mahj"]="mahajani",
 ["maka"]="makasar",
 ["mand"]="mandaic and mandaean",
 ["mani"]="manichaean",
 ["marc"]="marchen",
 ["math"]="mathematical alphanumeric symbols",
 ["medf"]="medefaidrin",
 ["mend"]="mende kikakui",
 ["merc"]="meroitic cursive",
 ["mero"]="meroitic hieroglyphs",
 ["mlm2"]="malayalam variant 2",
 ["mlym"]="malayalam",
 ["modi"]="modi",
 ["mong"]="mongolian",
 ["mroo"]="mro",
 ["mtei"]="meitei Mayek",
 ["mult"]="multani",
 ["musc"]="musical symbols",
 ["mym2"]="myanmar variant 2",
 ["mymr"]="myanmar",
 ["narb"]="old north arabian",
 ["nbat"]="nabataean",
 ["newa"]="newa",
 ["nko" ]='n"ko',
 ["nshu"]="nüshu",
 ["ogam"]="ogham",
 ["olck"]="ol chiki",
 ["orkh"]="old turkic and orkhon runic",
 ["ory2"]="odia variant 2",
 ["orya"]="oriya",
 ["osge"]="osage",
 ["osma"]="osmanya",
 ["palm"]="palmyrene",
 ["pauc"]="pau cin hau",
 ["perm"]="old permic",
 ["phag"]="phags-pa",
 ["phli"]="inscriptional pahlavi",
 ["phlp"]="psalter pahlavi",
 ["phnx"]="phoenician",
 ["plrd"]="miao",
 ["prti"]="inscriptional parthian",
 ["rjng"]="rejang",
 ["rohg"]="hanifi rohingya",
 ["runr"]="runic",
 ["samr"]="samaritan",
 ["sarb"]="old south arabian",
 ["saur"]="saurashtra",
 ["sgnw"]="sign writing",
 ["shaw"]="shavian",
 ["shrd"]="sharada",
 ["sidd"]="siddham",
 ["sind"]="khudawadi",
 ["sinh"]="sinhala",
 ["sogd"]="sogdian",
 ["sogo"]="old sogdian",
 ["sora"]="sora sompeng",
 ["soyo"]="soyombo",
 ["sund"]="sundanese",
 ["sylo"]="syloti nagri",
 ["syrc"]="syriac",
 ["tagb"]="tagbanwa",
 ["takr"]="takri",
 ["tale"]="tai le",
 ["talu"]="tai lu",
 ["taml"]="tamil",
 ["tang"]="tangut",
 ["tavt"]="tai viet",
 ["tel2"]="telugu variant 2",
 ["telu"]="telugu",
 ["tfng"]="tifinagh",
 ["tglg"]="tagalog",
 ["thaa"]="thaana",
 ["thai"]="thai",
 ["tibt"]="tibetan",
 ["tirh"]="tirhuta",
 ["tml2"]="tamil variant 2",
 ["ugar"]="ugaritic cuneiform",
 ["vai" ]="vai",
 ["wara"]="warang citi",
 ["xpeo"]="old persian cuneiform",
 ["xsux"]="sumero-akkadian cuneiform",
 ["yi"  ]="yi",
 ["zanb"]="zanabazar square",
}
local languages=allocate {
 ["aba" ]="abaza",
 ["abk" ]="abkhazian",
 ["ach" ]="acholi",
 ["acr" ]="achi",
 ["ady" ]="adyghe",
 ["afk" ]="afrikaans",
 ["afr" ]="afar",
 ["agw" ]="agaw",
 ["aio" ]="aiton",
 ["aka" ]="akan",
 ["als" ]="alsatian",
 ["alt" ]="altai",
 ["amh" ]="amharic",
 ["ang" ]="anglo-saxon",
 ["apph"]="phonetic transcription—americanist conventions",
 ["ara" ]="arabic",
 ["arg" ]="aragonese",
 ["ari" ]="aari",
 ["ark" ]="rakhine",
 ["asm" ]="assamese",
 ["ast" ]="asturian",
 ["ath" ]="athapaskan",
 ["avr" ]="avar",
 ["awa" ]="awadhi",
 ["aym" ]="aymara",
 ["azb" ]="torki",
 ["aze" ]="azerbaijani",
 ["bad" ]="badaga",
 ["bad0"]="banda",
 ["bag" ]="baghelkhandi",
 ["bal" ]="balkar",
 ["ban" ]="balinese",
 ["bar" ]="bavarian",
 ["bau" ]="baulé",
 ["bbc" ]="batak toba",
 ["bbr" ]="berber",
 ["bch" ]="bench",
 ["bcr" ]="bible cree",
 ["bdy" ]="bandjalang",
 ["bel" ]="belarussian",
 ["bem" ]="bemba",
 ["ben" ]="bengali",
 ["bgc" ]="haryanvi",
 ["bgq" ]="bagri",
 ["bgr" ]="bulgarian",
 ["bhi" ]="bhili",
 ["bho" ]="bhojpuri",
 ["bik" ]="bikol",
 ["bil" ]="bilen",
 ["bis" ]="bislama",
 ["bjj" ]="kanauji",
 ["bkf" ]="blackfoot",
 ["bli" ]="baluchi",
 ["blk" ]="pa'o karen",
 ["bln" ]="balante",
 ["blt" ]="balti",
 ["bmb" ]="bambara (bamanankan)",
 ["bml" ]="bamileke",
 ["bos" ]="bosnian",
 ["bpy" ]="bishnupriya manipuri",
 ["bre" ]="breton",
 ["brh" ]="brahui",
 ["bri" ]="braj bhasha",
 ["brm" ]="burmese",
 ["brx" ]="bodo",
 ["bsh" ]="bashkir",
 ["bsk" ]="burushaski",
 ["bti" ]="beti",
 ["bts" ]="batak simalungun",
 ["bug" ]="bugis",
 ["byv" ]="medumba",
 ["cak" ]="kaqchikel",
 ["cat" ]="catalan",
 ["cbk" ]="zamboanga chavacano",
 ["cchn"]="chinantec",
 ["ceb" ]="cebuano",
 ["cgg" ]="chiga",
 ["cha" ]="chamorro",
 ["che" ]="chechen",
 ["chg" ]="chaha gurage",
 ["chh" ]="chattisgarhi",
 ["chi" ]="chichewa (chewa, nyanja)",
 ["chk" ]="chukchi",
 ["chk0"]="chuukese",
 ["cho" ]="choctaw",
 ["chp" ]="chipewyan",
 ["chr" ]="cherokee",
 ["chu" ]="chuvash",
 ["chy" ]="cheyenne",
 ["cja" ]="western cham",
 ["cjm" ]="eastern cham",
 ["cmr" ]="comorian",
 ["cop" ]="coptic",
 ["cor" ]="cornish",
 ["cos" ]="corsican",
 ["cpp" ]="creoles",
 ["cre" ]="cree",
 ["crr" ]="carrier",
 ["crt" ]="crimean tatar",
 ["csb" ]="kashubian",
 ["csl" ]="church slavonic",
 ["csy" ]="czech",
 ["ctg" ]="chittagonian",
 ["cuk" ]="san blas kuna",
 ["dan" ]="danish",
 ["dar" ]="dargwa",
 ["dax" ]="dayi",
 ["dcr" ]="woods cree",
 ["deu" ]="german",
 ["dgo" ]="dogri",
 ["dgr" ]="dogri",
 ["dhg" ]="dhangu",
 ["dhv" ]="divehi (dhivehi, maldivian)",
 ["diq" ]="dimli",
 ["div" ]="divehi (dhivehi, maldivian)",
 ["djr" ]="zarma",
 ["djr0"]="djambarrpuyngu",
 ["dng" ]="dangme",
 ["dnj" ]="dan",
 ["dnk" ]="dinka",
 ["dri" ]="dari",
 ["duj" ]="dhuwal",
 ["dun" ]="dungan",
 ["dzn" ]="dzongkha",
 ["ebi" ]="ebira",
 ["ecr" ]="eastern cree",
 ["edo" ]="edo",
 ["efi" ]="efik",
 ["ell" ]="greek",
 ["emk" ]="eastern maninkakan",
 ["eng" ]="english",
 ["erz" ]="erzya",
 ["esp" ]="spanish",
 ["esu" ]="central yupik",
 ["eti" ]="estonian",
 ["euq" ]="basque",
 ["evk" ]="evenki",
 ["evn" ]="even",
 ["ewe" ]="ewe",
 ["fan" ]="french antillean",
 ["fan0"]=" fang",
 ["far" ]="persian",
 ["fat" ]="fanti",
 ["fin" ]="finnish",
 ["fji" ]="fijian",
 ["fle" ]="dutch (flemish)",
 ["fmp" ]="fe’fe’",
 ["fne" ]="forest nenets",
 ["fon" ]="fon",
 ["fos" ]="faroese",
 ["fra" ]="french",
 ["frc" ]="cajun french",
 ["fri" ]="frisian",
 ["frl" ]="friulian",
 ["frp" ]="arpitan",
 ["fta" ]="futa",
 ["ful" ]="fulah",
 ["fuv" ]="nigerian fulfulde",
 ["gad" ]="ga",
 ["gae" ]="scottish gaelic (gaelic)",
 ["gag" ]="gagauz",
 ["gal" ]="galician",
 ["gar" ]="garshuni",
 ["gaw" ]="garhwali",
 ["gez" ]="ge'ez",
 ["gih" ]="githabul",
 ["gil" ]="gilyak",
 ["gil0"]="kiribati (gilbertese)",
 ["gkp" ]="kpelle (guinea)",
 ["glk" ]="gilaki",
 ["gmz" ]="gumuz",
 ["gnn" ]="gumatj",
 ["gog" ]="gogo",
 ["gon" ]="gondi",
 ["grn" ]="greenlandic",
 ["gro" ]="garo",
 ["gua" ]="guarani",
 ["guc" ]="wayuu",
 ["guf" ]="gupapuyngu",
 ["guj" ]="gujarati",
 ["guz" ]="gusii",
 ["hai" ]="haitian (haitian creole)",
 ["hal" ]="halam",
 ["har" ]="harauti",
 ["hau" ]="hausa",
 ["haw" ]="hawaiian",
 ["hay" ]="haya",
 ["haz" ]="hazaragi",
 ["hbn" ]="hammer-banna",
 ["her" ]="herero",
 ["hil" ]="hiligaynon",
 ["hin" ]="hindi",
 ["hma" ]="high mari",
 ["hmn" ]="hmong",
 ["hmo" ]="hiri motu",
 ["hnd" ]="hindko",
 ["ho"  ]="ho",
 ["hri" ]="harari",
 ["hrv" ]="croatian",
 ["hun" ]="hungarian",
 ["hye" ]="armenian",
 ["hye0"]="armenian east",
 ["iba" ]="iban",
 ["ibb" ]="ibibio",
 ["ibo" ]="igbo",
 ["ido" ]="ido",
 ["ijo" ]="ijo languages",
 ["ile" ]="interlingue",
 ["ilo" ]="ilokano",
 ["ina" ]="interlingua",
 ["ind" ]="indonesian",
 ["ing" ]="ingush",
 ["inu" ]="inuktitut",
 ["ipk" ]="inupiat",
 ["ipph"]="phonetic transcription—ipa conventions",
 ["iri" ]="irish",
 ["irt" ]="irish traditional",
 ["isl" ]="icelandic",
 ["ism" ]="inari sami",
 ["ita" ]="italian",
 ["iwr" ]="hebrew",
 ["jam" ]="jamaican creole",
 ["jan" ]="japanese",
 ["jav" ]="javanese",
 ["jbo" ]="lojban",
 ["jct" ]="krymchak",
 ["jii" ]="yiddish",
 ["jud" ]="ladino",
 ["jul" ]="jula",
 ["kab" ]="kabardian",
 ["kab0"]="kabyle",
 ["kac" ]="kachchi",
 ["kal" ]="kalenjin",
 ["kan" ]="kannada",
 ["kar" ]="karachay",
 ["kat" ]="georgian",
 ["kaz" ]="kazakh",
 ["kde" ]="makonde",
 ["kea" ]="kabuverdianu (crioulo)",
 ["keb" ]="kebena",
 ["kek" ]="kekchi",
 ["kge" ]="khutsuri georgian",
 ["kha" ]="khakass",
 ["khk" ]="khanty-kazim",
 ["khm" ]="khmer",
 ["khs" ]="khanty-shurishkar",
 ["kht" ]="khamti shan",
 ["khv" ]="khanty-vakhi",
 ["khw" ]="khowar",
 ["kik" ]="kikuyu (gikuyu)",
 ["kir" ]="kirghiz (kyrgyz)",
 ["kis" ]="kisii",
 ["kiu" ]="kirmanjki",
 ["kjd" ]="southern kiwai",
 ["kjp" ]="eastern pwo karen",
 ["kjz" ]="bumthangkha",
 ["kkn" ]="kokni",
 ["klm" ]="kalmyk",
 ["kmb" ]="kamba",
 ["kmn" ]="kumaoni",
 ["kmo" ]="komo",
 ["kms" ]="komso",
 ["kmz" ]="khorasani turkic",
 ["knr" ]="kanuri",
 ["kod" ]="kodagu",
 ["koh" ]="korean old hangul",
 ["kok" ]="konkani",
 ["kom" ]="komi",
 ["kon" ]="kikongo",
 ["kon0"]="kongo",
 ["kop" ]="komi-permyak",
 ["kor" ]="korean",
 ["kos" ]="kosraean",
 ["koz" ]="komi-zyrian",
 ["kpl" ]="kpelle",
 ["kri" ]="krio",
 ["krk" ]="karakalpak",
 ["krl" ]="karelian",
 ["krm" ]="karaim",
 ["krn" ]="karen",
 ["krt" ]="koorete",
 ["ksh" ]="kashmiri",
 ["ksh0"]="ripuarian",
 ["ksi" ]="khasi",
 ["ksm" ]="kildin sami",
 ["ksw" ]="s’gaw karen",
 ["kua" ]="kuanyama",
 ["kui" ]="kui",
 ["kul" ]="kulvi",
 ["kum" ]="kumyk",
 ["kur" ]="kurdish",
 ["kuu" ]="kurukh",
 ["kuy" ]="kuy",
 ["kyk" ]="koryak",
 ["kyu" ]="western kayah",
 ["lad" ]="ladin",
 ["lah" ]="lahuli",
 ["lak" ]="lak",
 ["lam" ]="lambani",
 ["lao" ]="lao",
 ["lat" ]="latin",
 ["laz" ]="laz",
 ["lcr" ]="l-cree",
 ["ldk" ]="ladakhi",
 ["lez" ]="lezgi",
 ["lij" ]="ligurian",
 ["lim" ]="limburgish",
 ["lin" ]="lingala",
 ["lis" ]="lisu",
 ["ljp" ]="lampung",
 ["lki" ]="laki",
 ["lma" ]="low mari",
 ["lmb" ]="limbu",
 ["lmo" ]="lombard",
 ["lmw" ]="lomwe",
 ["lom" ]="loma",
 ["lrc" ]="luri",
 ["lsb" ]="lower sorbian",
 ["lsm" ]="lule sami",
 ["lth" ]="lithuanian",
 ["ltz" ]="luxembourgish",
 ["lua" ]="luba-lulua",
 ["lub" ]="luba-katanga",
 ["lug" ]="ganda",
 ["luh" ]="luyia",
 ["luo" ]="luo",
 ["lvi" ]="latvian",
 ["mad" ]="madura",
 ["mag" ]="magahi",
 ["mah" ]="marshallese",
 ["maj" ]="majang",
 ["mak" ]="makhuwa",
 ["mal" ]="malayalam reformed",
 ["mam" ]="mam",
 ["man" ]="mansi",
 ["map" ]="mapudungun",
 ["mar" ]="marathi",
 ["maw" ]="marwari",
 ["mbn" ]="mbundu",
 ["mbo" ]="mbo",
 ["mch" ]="manchu",
 ["mcr" ]="moose cree",
 ["mde" ]="mende",
 ["mdr" ]="mandar",
 ["men" ]="me'en",
 ["mer" ]="meru",
 ["mfa" ]="pattani malay",
 ["mfe" ]="morisyen",
 ["min" ]="minangkabau",
 ["miz" ]="mizo",
 ["mkd" ]="macedonian",
 ["mkr" ]="makasar",
 ["mkw" ]="kituba",
 ["mle" ]="male",
 ["mlg" ]="malagasy",
 ["mln" ]="malinke",
 ["mlr" ]="malayalam reformed",
 ["mly" ]="malay",
 ["mnd" ]="mandinka",
 ["mng" ]="mongolian",
 ["mni" ]="manipuri",
 ["mnk" ]="maninka",
 ["mnx" ]="manx",
 ["moh" ]="mohawk",
 ["mok" ]="moksha",
 ["mol" ]="moldavian",
 ["mon" ]="mon",
 ["mor" ]="moroccan",
 ["mos" ]="mossi",
 ["mri" ]="maori",
 ["mth" ]="maithili",
 ["mts" ]="maltese",
 ["mun" ]="mundari",
 ["mus" ]="muscogee",
 ["mwl" ]="mirandese",
 ["mww" ]="hmong daw",
 ["myn" ]="mayan",
 ["mzn" ]="mazanderani",
 ["nag" ]="naga-assamese",
 ["nah" ]="nahuatl",
 ["nan" ]="nanai",
 ["nap" ]="neapolitan",
 ["nas" ]="naskapi",
 ["nau" ]="nauruan",
 ["nav" ]="navajo",
 ["ncr" ]="n-cree",
 ["ndb" ]="ndebele",
 ["ndc" ]="ndau",
 ["ndg" ]="ndonga",
 ["nds" ]="low saxon",
 ["nep" ]="nepali",
 ["new" ]="newari",
 ["nga" ]="ngbaka",
 ["ngr" ]="nagari",
 ["nhc" ]="norway house cree",
 ["nis" ]="nisi",
 ["niu" ]="niuean",
 ["nkl" ]="nyankole",
 ["nko" ]="n'ko",
 ["nld" ]="dutch",
 ["noe" ]="nimadi",
 ["nog" ]="nogai",
 ["nor" ]="norwegian",
 ["nov" ]="novial",
 ["nsm" ]="northern sami",
 ["nso" ]="sotho, northern",
 ["nta" ]="northern tai",
 ["nto" ]="esperanto",
 ["nym" ]="nyamwezi",
 ["nyn" ]="norwegian nynorsk",
 ["nza" ]="mbembe tigon",
 ["oci" ]="occitan",
 ["ocr" ]="oji-cree",
 ["ojb" ]="ojibway",
 ["ori" ]="odia",
 ["oro" ]="oromo",
 ["oss" ]="ossetian",
 ["paa" ]="palestinian aramaic",
 ["pag" ]="pangasinan",
 ["pal" ]="pali",
 ["pam" ]="pampangan",
 ["pan" ]="punjabi",
 ["pap" ]="palpa",
 ["pap0"]="papiamentu",
 ["pas" ]="pashto",
 ["pau" ]="palauan",
 ["pcc" ]="bouyei",
 ["pcd" ]="picard",
 ["pdc" ]="pennsylvania german",
 ["pgr" ]="polytonic greek",
 ["phk" ]="phake",
 ["pih" ]="norfolk",
 ["pil" ]="filipino",
 ["plg" ]="palaung",
 ["plk" ]="polish",
 ["pms" ]="piemontese",
 ["pnb" ]="western panjabi",
 ["poh" ]="pocomchi",
 ["pon" ]="pohnpeian",
 ["pro" ]="provencal",
 ["ptg" ]="portuguese",
 ["pwo" ]="western pwo karen",
 ["qin" ]="chin",
 ["quc" ]="k’iche’",
 ["quh" ]="quechua (bolivia)",
 ["quz" ]="quechua",
 ["qvi" ]="quechua (ecuador)",
 ["qwh" ]="quechua (peru)",
 ["raj" ]="rajasthani",
 ["rar" ]="rarotongan",
 ["rbu" ]="russian buriat",
 ["rcr" ]="r-cree",
 ["rej" ]="rejang",
 ["ria" ]="riang",
 ["rif" ]="tarifit",
 ["rit" ]="ritarungo",
 ["rkw" ]="arakwal",
 ["rms" ]="romansh",
 ["rmy" ]="vlax romani",
 ["rom" ]="romanian",
 ["roy" ]="romany",
 ["rsy" ]="rusyn",
 ["rtm" ]="rotuman",
 ["rua" ]="kinyarwanda",
 ["run" ]="rundi",
 ["rup" ]="aromanian",
 ["rus" ]="russian",
 ["sad" ]="sadri",
 ["san" ]="sanskrit",
 ["sas" ]="sasak",
 ["sat" ]="santali",
 ["say" ]="sayisi",
 ["scn" ]="sicilian",
 ["sco" ]="scots",
 ["scs" ]="north slavey",
 ["sek" ]="sekota",
 ["sel" ]="selkup",
 ["sga" ]="old irish",
 ["sgo" ]="sango",
 ["sgs" ]="samogitian",
 ["shi" ]="tachelhit",
 ["shn" ]="shan",
 ["sib" ]="sibe",
 ["sid" ]="sidamo",
 ["sig" ]="silte gurage",
 ["sks" ]="skolt sami",
 ["sky" ]="slovak",
 ["sla" ]="slavey",
 ["slv" ]="slovenian",
 ["sml" ]="somali",
 ["smo" ]="samoan",
 ["sna" ]="sena",
 ["sna0"]="shona",
 ["snd" ]="sindhi",
 ["snh" ]="sinhala (sinhalese)",
 ["snk" ]="soninke",
 ["sog" ]="sodo gurage",
 ["sop" ]="songe",
 ["sot" ]="sotho, southern",
 ["sqi" ]="albanian",
 ["srb" ]="serbian",
 ["srd" ]="sardinian",
 ["srk" ]="saraiki",
 ["srr" ]="serer",
 ["ssl" ]="south slavey",
 ["ssm" ]="southern sami",
 ["stq" ]="saterland frisian",
 ["suk" ]="sukuma",
 ["sun" ]="sundanese",
 ["sur" ]="suri",
 ["sva" ]="svan",
 ["sve" ]="swedish",
 ["swa" ]="swadaya aramaic",
 ["swk" ]="swahili",
 ["swz" ]="swati",
 ["sxt" ]="sutu",
 ["sxu" ]="upper saxon",
 ["syl" ]="sylheti",
 ["syr" ]="syriac",
 ["syre"]="estrangela syriac",
 ["syrj"]="western syriac",
 ["syrn"]="eastern syriac",
 ["szl" ]="silesian",
 ["tab" ]="tabasaran",
 ["taj" ]="tajiki",
 ["tam" ]="tamil",
 ["tat" ]="tatar",
 ["tcr" ]="th-cree",
 ["tdd" ]="dehong dai",
 ["tel" ]="telugu",
 ["tet" ]="tetum",
 ["tgl" ]="tagalog",
 ["tgn" ]="tongan",
 ["tgr" ]="tigre",
 ["tgy" ]="tigrinya",
 ["tha" ]="thai",
 ["tht" ]="tahitian",
 ["tib" ]="tibetan",
 ["tiv" ]="tiv",
 ["tkm" ]="turkmen",
 ["tmh" ]="tamashek",
 ["tmn" ]="temne",
 ["tna" ]="tswana",
 ["tne" ]="tundra nenets",
 ["tng" ]="tonga",
 ["tod" ]="todo",
 ["tod0"]="toma",
 ["tpi" ]="tok pisin",
 ["trk" ]="turkish",
 ["tsg" ]="tsonga",
 ["tsj" ]="tshangla",
 ["tua" ]="turoyo aramaic",
 ["tul" ]="tulu",
 ["tum" ]="tulu",
 ["tuv" ]="tuvin",
 ["tvl" ]="tuvalu",
 ["twi" ]="twi",
 ["tyz" ]="tày",
 ["tzm" ]="tamazight",
 ["tzo" ]="tzotzil",
 ["udm" ]="udmurt",
 ["ukr" ]="ukrainian",
 ["umb" ]="umbundu",
 ["urd" ]="urdu",
 ["usb" ]="upper sorbian",
 ["uyg" ]="uyghur",
 ["uzb" ]="uzbek",
 ["vec" ]="venetian",
 ["ven" ]="venda",
 ["vit" ]="vietnamese",
 ["vol" ]="volapük",
 ["vro" ]="võro",
 ["wa"  ]="wa",
 ["wag" ]="wagdi",
 ["war" ]="waray-waray",
 ["wcr" ]="west-cree",
 ["wel" ]="welsh",
 ["wlf" ]="wolof",
 ["wln" ]="walloon",
 ["wtm" ]="mewati",
 ["xbd" ]="lü",
 ["xhs" ]="xhosa",
 ["xjb" ]="minjangbal",
 ["xkf" ]="khengkha",
 ["xog" ]="soga",
 ["xpe" ]="kpelle (liberia)",
 ["yak" ]="sakha",
 ["yao" ]="yao",
 ["yap" ]="yapese",
 ["yba" ]="yoruba",
 ["ycr" ]="y-cree",
 ["yic" ]="yi classic",
 ["yim" ]="yi modern",
 ["zea" ]="zealandic",
 ["zgh" ]="standard morrocan tamazigh",
 ["zha" ]="zhuang",
 ["zhh" ]="chinese, hong kong sar",
 ["zhp" ]="chinese phonetic",
 ["zhs" ]="chinese simplified",
 ["zht" ]="chinese traditional",
 ["znd" ]="zande",
 ["zul" ]="zulu",
 ["zza" ]="zazaki",
}
local features=allocate {
 ["aalt"]="access all alternates",
 ["abvf"]="above-base forms",
 ["abvm"]="above-base mark positioning",
 ["abvs"]="above-base substitutions",
 ["afrc"]="alternative fractions",
 ["akhn"]="akhands",
 ["blwf"]="below-base forms",
 ["blwm"]="below-base mark positioning",
 ["blws"]="below-base substitutions",
 ["c2pc"]="petite capitals from capitals",
 ["c2sc"]="small capitals from capitals",
 ["calt"]="contextual alternates",
 ["case"]="case-sensitive forms",
 ["ccmp"]="glyph composition/decomposition",
 ["cfar"]="conjunct form after ro",
 ["cjct"]="conjunct forms",
 ["clig"]="contextual ligatures",
 ["cpct"]="centered cjk punctuation",
 ["cpsp"]="capital spacing",
 ["cswh"]="contextual swash",
 ["curs"]="cursive positioning",
 ["dflt"]="default processing",
 ["dist"]="distances",
 ["dlig"]="discretionary ligatures",
 ["dnom"]="denominators",
 ["dtls"]="dotless forms",
 ["expt"]="expert forms",
 ["falt"]="final glyph alternates",
 ["fin2"]="terminal forms #2",
 ["fin3"]="terminal forms #3",
 ["fina"]="terminal forms",
 ["flac"]="flattened accents over capitals",
 ["frac"]="fractions",
 ["fwid"]="full width",
 ["half"]="half forms",
 ["haln"]="halant forms",
 ["halt"]="alternate half width",
 ["hist"]="historical forms",
 ["hkna"]="horizontal kana alternates",
 ["hlig"]="historical ligatures",
 ["hngl"]="hangul",
 ["hojo"]="hojo kanji forms",
 ["hwid"]="half width",
 ["init"]="initial forms",
 ["isol"]="isolated forms",
 ["ital"]="italics",
 ["jalt"]="justification alternatives",
 ["jp04"]="jis2004 forms",
 ["jp78"]="jis78 forms",
 ["jp83"]="jis83 forms",
 ["jp90"]="jis90 forms",
 ["kern"]="kerning",
 ["lfbd"]="left bounds",
 ["liga"]="standard ligatures",
 ["ljmo"]="leading jamo forms",
 ["lnum"]="lining figures",
 ["locl"]="localized forms",
 ["ltra"]="left-to-right alternates",
 ["ltrm"]="left-to-right mirrored forms",
 ["mark"]="mark positioning",
 ["med2"]="medial forms #2",
 ["medi"]="medial forms",
 ["mgrk"]="mathematical greek",
 ["mkmk"]="mark to mark positioning",
 ["mset"]="mark positioning via substitution",
 ["nalt"]="alternate annotation forms",
 ["nlck"]="nlc kanji forms",
 ["nukt"]="nukta forms",
 ["numr"]="numerators",
 ["onum"]="old style figures",
 ["opbd"]="optical bounds",
 ["ordn"]="ordinals",
 ["ornm"]="ornaments",
 ["palt"]="proportional alternate width",
 ["pcap"]="petite capitals",
 ["pkna"]="proportional kana",
 ["pnum"]="proportional figures",
 ["pref"]="pre-base forms",
 ["pres"]="pre-base substitutions",
 ["pstf"]="post-base forms",
 ["psts"]="post-base substitutions",
 ["pwid"]="proportional widths",
 ["qwid"]="quarter widths",
 ["rand"]="randomize",
 ["rclt"]="required contextual alternates",
 ["rkrf"]="rakar forms",
 ["rlig"]="required ligatures",
 ["rphf"]="reph form",
 ["rtbd"]="right bounds",
 ["rtla"]="right-to-left alternates",
 ["rtlm"]="right to left mirrored forms",
 ["rvrn"]="required variation alternates",
 ["ruby"]="ruby notation forms",
 ["salt"]="stylistic alternates",
 ["sinf"]="scientific inferiors",
 ["size"]="optical size",
 ["smcp"]="small capitals",
 ["smpl"]="simplified forms",
 ["ssty"]="script style",
 ["stch"]="stretching glyph decomposition",
 ["subs"]="subscript",
 ["sups"]="superscript",
 ["swsh"]="swash",
 ["titl"]="titling",
 ["tjmo"]="trailing jamo forms",
 ["tnam"]="traditional name forms",
 ["tnum"]="tabular figures",
 ["trad"]="traditional forms",
 ["twid"]="third widths",
 ["unic"]="unicase",
 ["valt"]="alternate vertical metrics",
 ["vatu"]="vattu variants",
 ["vert"]="vertical writing",
 ["vhal"]="alternate vertical half metrics",
 ["vjmo"]="vowel jamo forms",
 ["vkna"]="vertical kana alternates",
 ["vkrn"]="vertical kerning",
 ["vpal"]="proportional alternate vertical metrics",
 ["vrtr"]="vertical alternates for rotation",
 ["vrt2"]="vertical rotation",
 ["zero"]="slashed zero",
 ["trep"]="traditional tex replacements",
 ["tlig"]="traditional tex ligatures",
 ["ss.."]="stylistic set ..",
 ["cv.."]="character variant ..",
 ["js.."]="justification ..",
 ["dv.."]="devanagari ..",
 ["ml.."]="malayalam ..",
}
local baselines=allocate {
 ["hang"]="hanging baseline",
 ["icfb"]="ideographic character face bottom edge baseline",
 ["icft"]="ideographic character face tope edige baseline",
 ["ideo"]="ideographic em-box bottom edge baseline",
 ["idtp"]="ideographic em-box top edge baseline",
 ["math"]="mathematical centered baseline",
 ["romn"]="roman baseline"
}
tables.scripts=scripts
tables.languages=languages
tables.features=features
tables.baselines=baselines
local acceptscripts=true  directives.register("otf.acceptscripts",function(v) acceptscripts=v end)
local acceptlanguages=true  directives.register("otf.acceptlanguages",function(v) acceptlanguages=v end)
local report_checks=logs.reporter("fonts","checks")
if otffeatures.features then
 for k,v in next,otffeatures.features do
  features[k]=v
 end
 otffeatures.features=features
end
local function swapped(h)
 local r={}
 for k,v in next,h do
  r[gsub(v,"[^a-z0-9]","")]=k 
 end
 return r
end
local verbosescripts=allocate(swapped(scripts  ))
local verboselanguages=allocate(swapped(languages))
local verbosefeatures=allocate(swapped(features ))
local verbosebaselines=allocate(swapped(baselines))
local function resolve(t,k)
 if k then
  k=gsub(lower(k),"[^a-z0-9]","")
  local v=rawget(t,k)
  if v then
   return v
  end
 end
end
setmetatableindex(verbosescripts,resolve)
setmetatableindex(verboselanguages,resolve)
setmetatableindex(verbosefeatures,resolve)
setmetatableindex(verbosebaselines,resolve)
setmetatableindex(scripts,function(t,k)
 if k then
  k=lower(k)
  if k=="dflt" then
   return k
  end
  local v=rawget(t,k)
  if v then
   return v
  end
  k=gsub(k," ","")
  v=rawget(t,v)
  if v then
   return v
  elseif acceptscripts then
   report_checks("registering extra script %a",k)
   rawset(t,k,k)
   return k
  end
 end
 return "dflt"
end)
setmetatableindex(languages,function(t,k)
 if k then
  k=lower(k)
  if k=="dflt" then
   return k
  end
  local v=rawget(t,k)
  if v then
   return v
  end
  k=gsub(k," ","")
  v=rawget(t,v)
  if v then
   return v
  elseif acceptlanguages then
   report_checks("registering extra language %a",k)
   rawset(t,k,k)
   return k
  end
 end
 return "dflt"
end)
if setmetatablenewindex then
 setmetatablenewindex(languages,"ignore")
 setmetatablenewindex(scripts,"ignore")
 setmetatablenewindex(baselines,"ignore")
end
local function resolve(t,k)
 if k then
  k=lower(k)
  local v=rawget(t,k)
  if v then
   return v
  end
  k=gsub(k," ","")
  local v=rawget(t,k)
  if v then
   return v
  end
  local tag,dd=match(k,"(..)(%d+)")
  if tag and dd then
   local v=rawget(t,tag)
   if v then
    return v 
   else
    local v=rawget(t,tag.."..") 
    if v then
     return (gsub(v,"%.%.",tonumber(dd))) 
    end
   end
  end
 end
 return k 
end
setmetatableindex(features,resolve)
local function assign(t,k,v)
 if k and v then
  v=lower(v)
  rawset(t,k,v)
 end
end
if setmetatablenewindex then
 setmetatablenewindex(features,assign)
end
local checkers={
 rand=function(v)
  return v==true and "random" or v
 end
}
if not storage then
 return
end
local usedfeatures=statistics.usedfeatures or {}
statistics.usedfeatures=usedfeatures
table.setmetatableindex(usedfeatures,function(t,k) if k then local v={} t[k]=v return v end end) 
storage.register("fonts/otf/usedfeatures",usedfeatures,"fonts.handlers.otf.statistics.usedfeatures" )
local normalizedaxis=otf.readers.helpers.normalizedaxis or function(s) return s end
function otffeatures.normalize(features,wrap) 
 if features then
  local h={}
  for key,value in next,features do
   local k=lower(key)
   if k=="language" then
    local v=gsub(lower(value),"[^a-z0-9]","")
    h.language=rawget(verboselanguages,v) or (languages[v] and v) or "dflt" 
   elseif k=="script" then
    local v=gsub(lower(value),"[^a-z0-9]","")
    h.script=rawget(verbosescripts,v) or (scripts[v] and v) or "dflt" 
   elseif k=="axis" then
    h[k]=normalizedaxis(value)
   else
    local uk=usedfeatures[key]
    local uv=uk[value]
    if uv then
    else
     uv=tonumber(value) 
     if uv then
     elseif type(value)=="string" then
      local b=is_boolean(value)
      if type(b)=="nil" then
       if wrap and find(value,",") then
        uv="{"..lower(value).."}"
       else
        uv=lower(value)
       end
      else
       uv=b
      end
     elseif type(value)=="table" then
      uv=sequenced(t,",")
     else
      uv=value
     end
     if not rawget(features,k) then
      k=rawget(verbosefeatures,k) or k
     end
     local c=checkers[k]
     if c then
      uv=c(uv) or vc
     end
     uk[value]=uv
    end
    h[k]=uv
   end
  end
  return h
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ott”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-cff” e38c1a40e1d1d577cdf7920fa50d0654] ---

if not modules then modules={} end modules ['font-cff']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type,tonumber,rawget=next,type,tonumber,rawget
local byte,char,gmatch,sub=string.byte,string.char,string.gmatch,string.sub
local concat,insert,remove,unpack=table.concat,table.insert,table.remove,table.unpack
local floor,abs,round,ceil,min,max=math.floor,math.abs,math.round,math.ceil,math.min,math.max
local P,C,R,S,C,Cs,Ct=lpeg.P,lpeg.C,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Ct
local lpegmatch=lpeg.match
local formatters=string.formatters
local bytetable=string.bytetable
local idiv=number.idiv
local rshift,band,extract=bit32.rshift,bit32.band,bit32.extract
local readers=fonts.handlers.otf.readers
local streamreader=readers.streamreader
local readstring=streamreader.readstring
local readbyte=streamreader.readcardinal1  
local readushort=streamreader.readcardinal2  
local readuint=streamreader.readcardinal3  
local readulong=streamreader.readcardinal4  
local setposition=streamreader.setposition
local getposition=streamreader.getposition
local readbytetable=streamreader.readbytetable
directives.register("fonts.streamreader",function()
 streamreader=utilities.streams
 readstring=streamreader.readstring
 readbyte=streamreader.readcardinal1
 readushort=streamreader.readcardinal2
 readuint=streamreader.readcardinal3
 readulong=streamreader.readcardinal4
 setposition=streamreader.setposition
 getposition=streamreader.getposition
 readbytetable=streamreader.readbytetable
end)
local setmetatableindex=table.setmetatableindex
local trace_charstrings=false trackers.register("fonts.cff.charstrings",function(v) trace_charstrings=v end)
local report=logs.reporter("otf reader","cff")
local parsedictionaries
local parsecharstring
local parsecharstrings
local resetcharstrings
local parseprivates
local startparsing
local stopparsing
local defaultstrings={ [0]=
 ".notdef","space","exclam","quotedbl","numbersign","dollar","percent",
 "ampersand","quoteright","parenleft","parenright","asterisk","plus",
 "comma","hyphen","period","slash","zero","one","two","three","four",
 "five","six","seven","eight","nine","colon","semicolon","less",
 "equal","greater","question","at","A","B","C","D","E","F","G","H",
 "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W",
 "X","Y","Z","bracketleft","backslash","bracketright","asciicircum",
 "underscore","quoteleft","a","b","c","d","e","f","g","h","i","j",
 "k","l","m","n","o","p","q","r","s","t","u","v","w","x","y",
 "z","braceleft","bar","braceright","asciitilde","exclamdown","cent",
 "sterling","fraction","yen","florin","section","currency",
 "quotesingle","quotedblleft","guillemotleft","guilsinglleft",
 "guilsinglright","fi","fl","endash","dagger","daggerdbl",
 "periodcentered","paragraph","bullet","quotesinglbase","quotedblbase",
 "quotedblright","guillemotright","ellipsis","perthousand","questiondown",
 "grave","acute","circumflex","tilde","macron","breve","dotaccent",
 "dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash",
 "AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae",
 "dotlessi","lslash","oslash","oe","germandbls","onesuperior",
 "logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn",
 "onequarter","divide","brokenbar","degree","thorn","threequarters",
 "twosuperior","registered","minus","eth","multiply","threesuperior",
 "copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring",
 "Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave",
 "Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute",
 "Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute",
 "Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron",
 "aacute","acircumflex","adieresis","agrave","aring","atilde",
 "ccedilla","eacute","ecircumflex","edieresis","egrave","iacute",
 "icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex",
 "odieresis","ograve","otilde","scaron","uacute","ucircumflex",
 "udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall",
 "Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall",
 "Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader",
 "onedotenleader","zerooldstyle","oneoldstyle","twooldstyle",
 "threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle",
 "sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior",
 "threequartersemdash","periodsuperior","questionsmall","asuperior",
 "bsuperior","centsuperior","dsuperior","esuperior","isuperior",
 "lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior",
 "tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior",
 "Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall",
 "Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall",
 "Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall",
 "Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall",
 "Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah",
 "Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall",
 "Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall",
 "Dotaccentsmall","Macronsmall","figuredash","hypheninferior",
 "Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth",
 "threeeighths","fiveeighths","seveneighths","onethird","twothirds",
 "zerosuperior","foursuperior","fivesuperior","sixsuperior",
 "sevensuperior","eightsuperior","ninesuperior","zeroinferior",
 "oneinferior","twoinferior","threeinferior","fourinferior",
 "fiveinferior","sixinferior","seveninferior","eightinferior",
 "nineinferior","centinferior","dollarinferior","periodinferior",
 "commainferior","Agravesmall","Aacutesmall","Acircumflexsmall",
 "Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall",
 "Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall",
 "Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall",
 "Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall",
 "Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall",
 "Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall",
 "Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003",
 "Black","Bold","Book","Light","Medium","Regular","Roman","Semibold",
}
local standardnames={ [0]=
 false,false,false,false,false,false,false,false,false,false,false,
 false,false,false,false,false,false,false,false,false,false,false,
 false,false,false,false,false,false,false,false,false,false,
 "space","exclam","quotedbl","numbersign","dollar","percent",
 "ampersand","quoteright","parenleft","parenright","asterisk","plus",
 "comma","hyphen","period","slash","zero","one","two","three","four",
 "five","six","seven","eight","nine","colon","semicolon","less",
 "equal","greater","question","at","A","B","C","D","E","F","G","H",
 "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W",
 "X","Y","Z","bracketleft","backslash","bracketright","asciicircum",
 "underscore","quoteleft","a","b","c","d","e","f","g","h","i","j",
 "k","l","m","n","o","p","q","r","s","t","u","v","w","x","y",
 "z","braceleft","bar","braceright","asciitilde",false,false,false,
 false,false,false,false,false,false,false,false,false,false,false,
 false,false,false,false,false,false,false,false,false,false,false,
 false,false,false,false,false,false,false,false,false,"exclamdown",
 "cent","sterling","fraction","yen","florin","section","currency",
 "quotesingle","quotedblleft","guillemotleft","guilsinglleft",
 "guilsinglright","fi","fl",false,"endash","dagger","daggerdbl",
 "periodcentered",false,"paragraph","bullet","quotesinglbase",
 "quotedblbase","quotedblright","guillemotright","ellipsis","perthousand",
 false,"questiondown",false,"grave","acute","circumflex","tilde",
 "macron","breve","dotaccent","dieresis",false,"ring","cedilla",false,
 "hungarumlaut","ogonek","caron","emdash",false,false,false,false,
 false,false,false,false,false,false,false,false,false,false,false,
 false,"AE",false,"ordfeminine",false,false,false,false,"Lslash",
 "Oslash","OE","ordmasculine",false,false,false,false,false,"ae",
 false,false,false,"dotlessi",false,false,"lslash","oslash","oe",
 "germandbls",false,false,false,false
}
local cffreaders={
 readbyte,
 readushort,
 readuint,
 readulong,
}
directives.register("fonts.streamreader",function()
 cffreaders={
  readbyte,
  readushort,
  readuint,
  readulong,
 }
end)
local function readheader(f)
 local offset=getposition(f)
 local major=readbyte(f)
 local header={
  offset=offset,
  major=major,
  minor=readbyte(f),
  size=readbyte(f),
 }
 if major==1 then
  header.dsize=readbyte(f)   
 elseif major==2 then
  header.dsize=readushort(f) 
 else
 end
 setposition(f,offset+header.size)
 return header
end
local function readlengths(f,longcount)
 local count=longcount and readulong(f) or readushort(f)
 if count==0 then
  return {}
 end
 local osize=readbyte(f)
 local read=cffreaders[osize]
 if not read then
  report("bad offset size: %i",osize)
  return {}
 end
 local lengths={}
 local previous=read(f)
 for i=1,count do
  local offset=read(f)
  local length=offset-previous
  if length<0 then
   report("bad offset: %i",length)
   length=0
  end
  lengths[i]=length
  previous=offset
 end
 return lengths
end
local function readfontnames(f)
 local names=readlengths(f)
 for i=1,#names do
  names[i]=readstring(f,names[i])
 end
 return names
end
local function readtopdictionaries(f)
 local dictionaries=readlengths(f)
 for i=1,#dictionaries do
  dictionaries[i]=readstring(f,dictionaries[i])
 end
 return dictionaries
end
local function readstrings(f)
 local lengths=readlengths(f)
 local strings=setmetatableindex({},defaultstrings)
 local index=#defaultstrings
 for i=1,#lengths do
  index=index+1
  strings[index]=readstring(f,lengths[i])
 end
 return strings
end
do
 local stack={}
 local top=0
 local result={}
 local strings={}
 local p_single=P("\00")/function()
   result.version=strings[stack[top]] or "unset"
   top=0
  end+P("\01")/function()
   result.notice=strings[stack[top]] or "unset"
   top=0
  end+P("\02")/function()
   result.fullname=strings[stack[top]] or "unset"
   top=0
  end+P("\03")/function()
   result.familyname=strings[stack[top]] or "unset"
   top=0
  end+P("\04")/function()
   result.weight=strings[stack[top]] or "unset"
   top=0
  end+P("\05")/function()
   result.fontbbox={ unpack(stack,1,4) }
   top=0
  end+P("\06")/function()
   result.bluevalues={ unpack(stack,1,top) }
   top=0
  end+P("\07")/function()
   result.otherblues={ unpack(stack,1,top) }
   top=0
  end+P("\08")/function()
   result.familyblues={ unpack(stack,1,top) }
   top=0
  end+P("\09")/function()
   result.familyotherblues={ unpack(stack,1,top) }
   top=0
  end+P("\10")/function()
   result.strhw=stack[top]
   top=0
  end+P("\11")/function()
   result.strvw=stack[top]
   top=0
  end+P("\13")/function()
   result.uniqueid=stack[top]
   top=0
  end+P("\14")/function()
   result.xuid=concat(stack,"",1,top)
   top=0
  end+P("\15")/function()
   result.charset=stack[top]
   top=0
  end+P("\16")/function()
   result.encoding=stack[top]
   top=0
  end+P("\17")/function() 
   result.charstrings=stack[top]
   top=0
  end+P("\18")/function()
   result.private={
    size=stack[top-1],
    offset=stack[top],
   }
   top=0
  end+P("\19")/function()
   result.subroutines=stack[top]
   top=0 
  end+P("\20")/function()
   result.defaultwidthx=stack[top]
   top=0 
  end+P("\21")/function()
   result.nominalwidthx=stack[top]
   top=0 
  end
+P("\24")/function() 
   result.vstore=stack[top]
   top=0
  end+P("\25")/function() 
   result.maxstack=stack[top]
   top=0
  end
 local p_double=P("\12")*(
  P("\00")/function()
   result.copyright=stack[top]
   top=0
  end+P("\01")/function()
   result.monospaced=stack[top]==1 and true or false 
   top=0
  end+P("\02")/function()
   result.italicangle=stack[top]
   top=0
  end+P("\03")/function()
   result.underlineposition=stack[top]
   top=0
  end+P("\04")/function()
   result.underlinethickness=stack[top]
   top=0
  end+P("\05")/function()
   result.painttype=stack[top]
   top=0
  end+P("\06")/function()
   result.charstringtype=stack[top]
   top=0
  end+P("\07")/function() 
   result.fontmatrix={ unpack(stack,1,6) }
   top=0
  end+P("\08")/function()
   result.strokewidth=stack[top]
   top=0
  end+P("\09")/function()
   result.bluescale=stack[top]
   top=0
  end+P("\10")/function()
   result.bluesnap=stack[top]
   top=0
  end+P("\11")/function()
   result.bluefuzz=stack[top]
   top=0
  end+P("\12")/function()
   result.stemsnaph={ unpack(stack,1,top) }
   top=0
  end+P("\13")/function()
   result.stemsnapv={ unpack(stack,1,top) }
   top=0
  end+P("\20")/function()
   result.syntheticbase=stack[top]
   top=0
  end+P("\21")/function()
   result.postscript=strings[stack[top]] or "unset"
   top=0
  end+P("\22")/function()
   result.basefontname=strings[stack[top]] or "unset"
   top=0
  end+P("\21")/function()
   result.basefontblend=stack[top]
   top=0
  end+P("\30")/function()
   result.cid.registry=strings[stack[top-2]] or "unset"
   result.cid.ordering=strings[stack[top-1]] or "unset"
   result.cid.supplement=stack[top]
   top=0
  end+P("\31")/function()
   result.cid.fontversion=stack[top]
   top=0
  end+P("\32")/function()
   result.cid.fontrevision=stack[top]
   top=0
  end+P("\33")/function()
   result.cid.fonttype=stack[top]
   top=0
  end+P("\34")/function()
   result.cid.count=stack[top]
   top=0
  end+P("\35")/function()
   result.cid.uidbase=stack[top]
   top=0
  end+P("\36")/function() 
   result.cid.fdarray=stack[top]
   top=0
  end+P("\37")/function() 
   result.cid.fdselect=stack[top]
   top=0
  end+P("\38")/function()
   result.cid.fontname=strings[stack[top]] or "unset"
   top=0
  end
 )
 local remap={
  ["\x00"]="00",["\x01"]="01",["\x02"]="02",["\x03"]="03",["\x04"]="04",["\x05"]="05",["\x06"]="06",["\x07"]="07",["\x08"]="08",["\x09"]="09",["\x0A"]="0.",["\x0B"]="0E",["\x0C"]="0E-",["\x0D"]="0",["\x0E"]="0-",["\x0F"]="0",
  ["\x10"]="10",["\x11"]="11",["\x12"]="12",["\x13"]="13",["\x14"]="14",["\x15"]="15",["\x16"]="16",["\x17"]="17",["\x18"]="18",["\x19"]="19",["\x1A"]="1.",["\x1B"]="1E",["\x1C"]="1E-",["\x1D"]="1",["\x1E"]="1-",["\x1F"]="1",
  ["\x20"]="20",["\x21"]="21",["\x22"]="22",["\x23"]="23",["\x24"]="24",["\x25"]="25",["\x26"]="26",["\x27"]="27",["\x28"]="28",["\x29"]="29",["\x2A"]="2.",["\x2B"]="2E",["\x2C"]="2E-",["\x2D"]="2",["\x2E"]="2-",["\x2F"]="2",
  ["\x30"]="30",["\x31"]="31",["\x32"]="32",["\x33"]="33",["\x34"]="34",["\x35"]="35",["\x36"]="36",["\x37"]="37",["\x38"]="38",["\x39"]="39",["\x3A"]="3.",["\x3B"]="3E",["\x3C"]="3E-",["\x3D"]="3",["\x3E"]="3-",["\x3F"]="3",
  ["\x40"]="40",["\x41"]="41",["\x42"]="42",["\x43"]="43",["\x44"]="44",["\x45"]="45",["\x46"]="46",["\x47"]="47",["\x48"]="48",["\x49"]="49",["\x4A"]="4.",["\x4B"]="4E",["\x4C"]="4E-",["\x4D"]="4",["\x4E"]="4-",["\x4F"]="4",
  ["\x50"]="50",["\x51"]="51",["\x52"]="52",["\x53"]="53",["\x54"]="54",["\x55"]="55",["\x56"]="56",["\x57"]="57",["\x58"]="58",["\x59"]="59",["\x5A"]="5.",["\x5B"]="5E",["\x5C"]="5E-",["\x5D"]="5",["\x5E"]="5-",["\x5F"]="5",
  ["\x60"]="60",["\x61"]="61",["\x62"]="62",["\x63"]="63",["\x64"]="64",["\x65"]="65",["\x66"]="66",["\x67"]="67",["\x68"]="68",["\x69"]="69",["\x6A"]="6.",["\x6B"]="6E",["\x6C"]="6E-",["\x6D"]="6",["\x6E"]="6-",["\x6F"]="6",
  ["\x70"]="70",["\x71"]="71",["\x72"]="72",["\x73"]="73",["\x74"]="74",["\x75"]="75",["\x76"]="76",["\x77"]="77",["\x78"]="78",["\x79"]="79",["\x7A"]="7.",["\x7B"]="7E",["\x7C"]="7E-",["\x7D"]="7",["\x7E"]="7-",["\x7F"]="7",
  ["\x80"]="80",["\x81"]="81",["\x82"]="82",["\x83"]="83",["\x84"]="84",["\x85"]="85",["\x86"]="86",["\x87"]="87",["\x88"]="88",["\x89"]="89",["\x8A"]="8.",["\x8B"]="8E",["\x8C"]="8E-",["\x8D"]="8",["\x8E"]="8-",["\x8F"]="8",
  ["\x90"]="90",["\x91"]="91",["\x92"]="92",["\x93"]="93",["\x94"]="94",["\x95"]="95",["\x96"]="96",["\x97"]="97",["\x98"]="98",["\x99"]="99",["\x9A"]="9.",["\x9B"]="9E",["\x9C"]="9E-",["\x9D"]="9",["\x9E"]="9-",["\x9F"]="9",
  ["\xA0"]=".0",["\xA1"]=".1",["\xA2"]=".2",["\xA3"]=".3",["\xA4"]=".4",["\xA5"]=".5",["\xA6"]=".6",["\xA7"]=".7",["\xA8"]=".8",["\xA9"]=".9",["\xAA"]="..",["\xAB"]=".E",["\xAC"]=".E-",["\xAD"]=".",["\xAE"]=".-",["\xAF"]=".",
  ["\xB0"]="E0",["\xB1"]="E1",["\xB2"]="E2",["\xB3"]="E3",["\xB4"]="E4",["\xB5"]="E5",["\xB6"]="E6",["\xB7"]="E7",["\xB8"]="E8",["\xB9"]="E9",["\xBA"]="E.",["\xBB"]="EE",["\xBC"]="EE-",["\xBD"]="E",["\xBE"]="E-",["\xBF"]="E",
  ["\xC0"]="E-0",["\xC1"]="E-1",["\xC2"]="E-2",["\xC3"]="E-3",["\xC4"]="E-4",["\xC5"]="E-5",["\xC6"]="E-6",["\xC7"]="E-7",["\xC8"]="E-8",["\xC9"]="E-9",["\xCA"]="E-.",["\xCB"]="E-E",["\xCC"]="E-E-",["\xCD"]="E-",["\xCE"]="E--",["\xCF"]="E-",
  ["\xD0"]="-0",["\xD1"]="-1",["\xD2"]="-2",["\xD3"]="-3",["\xD4"]="-4",["\xD5"]="-5",["\xD6"]="-6",["\xD7"]="-7",["\xD8"]="-8",["\xD9"]="-9",["\xDA"]="-.",["\xDB"]="-E",["\xDC"]="-E-",["\xDD"]="-",["\xDE"]="--",["\xDF"]="-",
 }
 local p_last=S("\x0F\x1F\x2F\x3F\x4F\x5F\x6F\x7F\x8F\x9F\xAF\xBF")+R("\xF0\xFF")
 local p_nibbles=P("\30")*Cs(((1-p_last)/remap)^0*(P(1)/remap))/function(n)
  top=top+1
  stack[top]=tonumber(n) or 0
 end
 local p_byte=C(R("\32\246"))/function(b0)
  top=top+1
  stack[top]=byte(b0)-139
 end
 local p_positive=C(R("\247\250"))*C(1)/function(b0,b1)
  top=top+1
  stack[top]=(byte(b0)-247)*256+byte(b1)+108
 end
 local p_negative=C(R("\251\254"))*C(1)/function(b0,b1)
  top=top+1
  stack[top]=-(byte(b0)-251)*256-byte(b1)-108
 end
 local p_short=P("\28")*C(1)*C(1)/function(b1,b2)
  top=top+1
  local n=0x100*byte(b1)+byte(b2)
  if n>=0x8000 then
   stack[top]=n-0xFFFF-1
  else
   stack[top]=n
  end
 end
 local p_long=P("\29")*C(1)*C(1)*C(1)*C(1)/function(b1,b2,b3,b4)
  top=top+1
  local n=0x1000000*byte(b1)+0x10000*byte(b2)+0x100*byte(b3)+byte(b4)
  if n>=0x8000000 then
   stack[top]=n-0xFFFFFFFF-1
  else
   stack[top]=n
  end
 end
 local p_unsupported=P(1)/function(detail)
  top=0
 end
 local p_dictionary=(
  p_byte+p_positive+p_negative+p_short+p_long+p_nibbles+p_single+p_double
+p_unsupported
 )^1
 parsedictionaries=function(data,dictionaries,version)
  stack={}
  strings=data.strings
  if trace_charstrings then
   report("charstring format %a",version)
  end
  for i=1,#dictionaries do
   top=0
   result=version=="cff" and {
    monospaced=false,
    italicangle=0,
    underlineposition=-100,
    underlinethickness=50,
    painttype=0,
    charstringtype=2,
    fontmatrix={ 0.001,0,0,0.001,0,0 },
    fontbbox={ 0,0,0,0 },
    strokewidth=0,
    charset=0,
    encoding=0,
    cid={
     fontversion=0,
     fontrevision=0,
     fonttype=0,
     count=8720,
    }
   } or {
    charstringtype=2,
    charset=0,
    vstore=0,
    cid={
    },
   }
   lpegmatch(p_dictionary,dictionaries[i])
   dictionaries[i]=result
  end
  result={}
  top=0
  stack={}
 end
 parseprivates=function(data,dictionaries)
  stack={}
  strings=data.strings
  for i=1,#dictionaries do
   local private=dictionaries[i].private
   if private and private.data then
    top=0
    result={
     forcebold=false,
     languagegroup=0,
     expansionfactor=0.06,
     initialrandomseed=0,
     subroutines=0,
     defaultwidthx=0,
     nominalwidthx=0,
     cid={
     },
    }
    lpegmatch(p_dictionary,private.data)
    private.data=result
   end
  end
  result={}
  top=0
  stack={}
 end
 local x=0
 local y=0
 local width=false
 local lsb=0
local result={}
 local r=0
 local stems=0
 local globalbias=0
 local localbias=0
 local nominalwidth=0
 local defaultwidth=0
 local charset=false
 local globals=false
 local locals=false
 local depth=1
 local xmin=0
 local xmax=0
 local ymin=0
 local ymax=0
 local checked=false
 local keepcurve=false
 local version=2
 local regions=false
 local nofregions=0
 local region=false
 local factors=false
 local axis=false
 local vsindex=0
 local justpass=false
 local seacs={}
 local procidx=nil
 local function showstate(where)
  report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top)
 end
 local function showvalue(where,value,showstack)
  if showstack then
   report("%w%-10s : %s : [%s] n=%i",depth*2,where,tostring(value),concat(stack," ",1,top),top)
  else
   report("%w%-10s : %s",depth*2,where,tostring(value))
  end
 end
 local function xymoveto()
  if keepcurve then
   r=r+1
   result[r]={ x,y,"m" }
  end
  if checked then
   if x>xmax then xmax=x elseif x<xmin then xmin=x end
   if y>ymax then ymax=y elseif y<ymin then ymin=y end
  else
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  end
 end
 local function xmoveto() 
  if keepcurve then
   r=r+1
   result[r]={ x,y,"m" }
  end
  if not checked then
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  elseif x>xmax then
   xmax=x
  elseif x<xmin then
   xmin=x
  end
 end
 local function ymoveto() 
  if keepcurve then
   r=r+1
   result[r]={ x,y,"m" }
  end
  if not checked then
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  elseif y>ymax then
   ymax=y
  elseif y<ymin then
   ymin=y
  end
 end
 local function moveto()
  if trace_charstrings then
   showstate("moveto")
  end
  top=0 
  xymoveto()
 end
 local function xylineto() 
  if keepcurve then
   r=r+1
   result[r]={ x,y,"l" }
  end
  if checked then
   if x>xmax then xmax=x elseif x<xmin then xmin=x end
   if y>ymax then ymax=y elseif y<ymin then ymin=y end
  else
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  end
 end
 local function xlineto() 
  if keepcurve then
   r=r+1
   result[r]={ x,y,"l" }
  end
  if not checked then
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  elseif x>xmax then
   xmax=x
  elseif x<xmin then
   xmin=x
  end
 end
 local function ylineto() 
  if keepcurve then
   r=r+1
   result[r]={ x,y,"l" }
  end
  if not checked then
   xmin=x
   ymin=y
   xmax=x
   ymax=y
   checked=true
  elseif y>ymax then
   ymax=y
  elseif y<ymin then
   ymin=y
  end
 end
 local function xycurveto(x1,y1,x2,y2,x3,y3) 
  if trace_charstrings then
   showstate("curveto")
  end
  if keepcurve then
   r=r+1
   result[r]={ x1,y1,x2,y2,x3,y3,"c" }
  end
  if checked then
   if x1>xmax then xmax=x1 elseif x1<xmin then xmin=x1 end
   if y1>ymax then ymax=y1 elseif y1<ymin then ymin=y1 end
  else
   xmin=x1
   ymin=y1
   xmax=x1
   ymax=y1
   checked=true
  end
  if x2>xmax then xmax=x2 elseif x2<xmin then xmin=x2 end
  if y2>ymax then ymax=y2 elseif y2<ymin then ymin=y2 end
  if x3>xmax then xmax=x3 elseif x3<xmin then xmin=x3 end
  if y3>ymax then ymax=y3 elseif y3<ymin then ymin=y3 end
 end
 local function rmoveto()
  if not width then
   if top>2 then
    width=stack[1]
    if trace_charstrings then
     showvalue("backtrack width",width)
    end
   else
    width=true
   end
  end
  if trace_charstrings then
   showstate("rmoveto")
  end
  x=x+stack[top-1] 
  y=y+stack[top]   
  top=0
  xymoveto()
 end
 local function hmoveto()
  if not width then
   if top>1 then
    width=stack[1]
    if trace_charstrings then
     showvalue("backtrack width",width)
    end
   else
    width=true
   end
  end
  if trace_charstrings then
   showstate("hmoveto")
  end
  x=x+stack[top] 
  top=0
  xmoveto()
 end
 local function vmoveto()
  if not width then
   if top>1 then
    width=stack[1]
    if trace_charstrings then
     showvalue("backtrack width",width)
    end
   else
    width=true
   end
  end
  if trace_charstrings then
   showstate("vmoveto")
  end
  y=y+stack[top] 
  top=0
  ymoveto()
 end
 local function rlineto()
  if trace_charstrings then
   showstate("rlineto")
  end
  for i=1,top,2 do
   x=x+stack[i]   
   y=y+stack[i+1] 
   xylineto()
  end
  top=0
 end
 local function hlineto() 
  if trace_charstrings then
   showstate("hlineto")
  end
  if top==1 then
   x=x+stack[1]
   xlineto()
  else
   local swap=true
   for i=1,top do
    if swap then
     x=x+stack[i]
     xlineto()
     swap=false
    else
     y=y+stack[i]
     ylineto()
     swap=true
    end
   end
  end
  top=0
 end
 local function vlineto() 
  if trace_charstrings then
   showstate("vlineto")
  end
  if top==1 then
   y=y+stack[1]
   ylineto()
  else
   local swap=false
   for i=1,top do
    if swap then
     x=x+stack[i]
     xlineto()
     swap=false
    else
     y=y+stack[i]
     ylineto()
     swap=true
    end
   end
  end
  top=0
 end
 local function rrcurveto()
  if trace_charstrings then
   showstate("rrcurveto")
  end
  for i=1,top,6 do
   local ax=x+stack[i]   
   local ay=y+stack[i+1] 
   local bx=ax+stack[i+2] 
   local by=ay+stack[i+3] 
   x=bx+stack[i+4]  
   y=by+stack[i+5]  
   xycurveto(ax,ay,bx,by,x,y)
  end
  top=0
 end
 local function hhcurveto()
  if trace_charstrings then
   showstate("hhcurveto")
  end
  local s=1
  if top%2~=0 then
   y=y+stack[1]     
   s=2
  end
  for i=s,top,4 do
   local ax=x+stack[i] 
   local ay=y
   local bx=ax+stack[i+1] 
   local by=ay+stack[i+2] 
   x=bx+stack[i+3]  
   y=by
   xycurveto(ax,ay,bx,by,x,y)
  end
  top=0
 end
 local function vvcurveto()
  if trace_charstrings then
   showstate("vvcurveto")
  end
  local s=1
  local d=0
  if top%2~=0 then
   d=stack[1]      
   s=2
  end
  for i=s,top,4 do
   local ax=x+d
   local ay=y+stack[i] 
   local bx=ax+stack[i+1] 
   local by=ay+stack[i+2] 
   x=bx
   y=by+stack[i+3]  
   xycurveto(ax,ay,bx,by,x,y)
   d=0
  end
  top=0
 end
 local function xxcurveto(swap)
  local last=top%4~=0 and stack[top]
  if last then
   top=top-1
  end
  for i=1,top,4 do
   local ax,ay,bx,by
   if swap then
    ax=x+stack[i]
    ay=y
    bx=ax+stack[i+1]
    by=ay+stack[i+2]
    y=by+stack[i+3]
    if last and i+3==top then
     x=bx+last
    else
     x=bx
    end
    swap=false
   else
    ax=x
    ay=y+stack[i]
    bx=ax+stack[i+1]
    by=ay+stack[i+2]
    x=bx+stack[i+3]
    if last and i+3==top then
     y=by+last
    else
     y=by
    end
    swap=true
   end
   xycurveto(ax,ay,bx,by,x,y)
  end
  top=0
 end
 local function hvcurveto()
  if trace_charstrings then
   showstate("hvcurveto")
  end
  xxcurveto(true)
 end
 local function vhcurveto()
  if trace_charstrings then
   showstate("vhcurveto")
  end
  xxcurveto(false)
 end
 local function rcurveline()
  if trace_charstrings then
   showstate("rcurveline")
  end
  for i=1,top-2,6 do
   local ax=x+stack[i]   
   local ay=y+stack[i+1] 
   local bx=ax+stack[i+2] 
   local by=ay+stack[i+3] 
   x=bx+stack[i+4] 
   y=by+stack[i+5] 
   xycurveto(ax,ay,bx,by,x,y)
  end
  x=x+stack[top-1] 
  y=y+stack[top]   
  xylineto()
  top=0
 end
 local function rlinecurve()
  if trace_charstrings then
   showstate("rlinecurve")
  end
  if top>6 then
   for i=1,top-6,2 do
    x=x+stack[i]
    y=y+stack[i+1]
    xylineto()
   end
  end
  local ax=x+stack[top-5]
  local ay=y+stack[top-4]
  local bx=ax+stack[top-3]
  local by=ay+stack[top-2]
  x=bx+stack[top-1]
  y=by+stack[top]
  xycurveto(ax,ay,bx,by,x,y)
  top=0
 end
 local function flex() 
  if trace_charstrings then
   showstate("flex")
  end
  local ax=x+stack[1]  
  local ay=y+stack[2]  
  local bx=ax+stack[3]  
  local by=ay+stack[4]  
  local cx=bx+stack[5]  
  local cy=by+stack[6]  
  xycurveto(ax,ay,bx,by,cx,cy)
  local dx=cx+stack[7]  
  local dy=cy+stack[8]  
  local ex=dx+stack[9]  
  local ey=dy+stack[10] 
  x=ex+stack[11]  
  y=ey+stack[12]  
  xycurveto(dx,dy,ex,ey,x,y)
  top=0
 end
 local function hflex()
  if trace_charstrings then
   showstate("hflex")
  end
  local ax=x+stack[1] 
  local ay=y
  local bx=ax+stack[2] 
  local by=ay+stack[3] 
  local cx=bx+stack[4] 
  local cy=by
  xycurveto(ax,ay,bx,by,cx,cy)
  local dx=cx+stack[5] 
  local dy=by
  local ex=dx+stack[6] 
  local ey=y
  x=ex+stack[7]  
  xycurveto(dx,dy,ex,ey,x,y)
  top=0
 end
 local function hflex1()
  if trace_charstrings then
   showstate("hflex1")
  end
  local ax=x+stack[1] 
  local ay=y+stack[2] 
  local bx=ax+stack[3] 
  local by=ay+stack[4] 
  local cx=bx+stack[5] 
  local cy=by
  xycurveto(ax,ay,bx,by,cx,cy)
  local dx=cx+stack[6] 
  local dy=by
  local ex=dx+stack[7] 
  local ey=dy+stack[8] 
  x=ex+stack[9]  
  xycurveto(dx,dy,ex,ey,x,y)
  top=0
 end
 local function flex1()
  if trace_charstrings then
   showstate("flex1")
  end
  local ax=x+stack[1]  
  local ay=y+stack[2]  
  local bx=ax+stack[3]  
  local by=ay+stack[4]  
  local cx=bx+stack[5]  
  local cy=by+stack[6]  
  xycurveto(ax,ay,bx,by,cx,cy)
  local dx=cx+stack[7]  
  local dy=cy+stack[8]  
  local ex=dx+stack[9]  
  local ey=dy+stack[10] 
  if abs(ex-x)>abs(ey-y) then 
   x=ex+stack[11]
  else
   y=ey+stack[11]
  end
  xycurveto(dx,dy,ex,ey,x,y)
  top=0
 end
 local function getstem()
  if top==0 then
  elseif top%2~=0 then
   if width then
    remove(stack,1)
   else
    width=remove(stack,1)
    if trace_charstrings then
     showvalue("width",width)
    end
   end
   top=top-1
  end
  if trace_charstrings then
   showstate("stem")
  end
  stems=stems+idiv(top,2)
  top=0
 end
 local function getmask()
  if top==0 then
  elseif top%2~=0 then
   if width then
    remove(stack,1)
   else
    width=remove(stack,1)
    if trace_charstrings then
     showvalue("width",width)
    end
   end
   top=top-1
  end
  if trace_charstrings then
   showstate(operator==19 and "hintmark" or "cntrmask")
  end
  stems=stems+idiv(top,2)
  top=0
  if stems==0 then
  elseif stems<=8 then
   return 1
  else
   return idiv(stems+7,8)
  end
 end
 local function unsupported(t)
  if trace_charstrings then
   showstate("unsupported "..t)
  end
  top=0
 end
 local function unsupportedsub(t)
  if trace_charstrings then
   showstate("unsupported sub "..t)
  end
  top=0
 end
 local function getstem3()
  if trace_charstrings then
   showstate("stem3")
  end
  top=0
 end
 local function divide()
  if version=="cff" then
   local d=stack[top]
   top=top-1
   stack[top]=stack[top]/d
  end
 end
 local function closepath()
  if version=="cff" then
   if trace_charstrings then
    showstate("closepath")
   end
  end
  top=0
 end
 local function hsbw()
  if version=="cff" then
   if trace_charstrings then
    showstate("hsbw")
   end
   lsb=stack[top-1] or 0
   width=stack[top]
  end
  top=0
 end
 local function sbw()
  if version=="cff" then
   if trace_charstrings then
    showstate("sbw")
   end
   lsb=stack[top-3]
   width=stack[top-1]
  end
  top=0
 end
 local function seac()
  if version=="cff" then
   if trace_charstrings then
    showstate("seac")
   end
  end
  top=0
 end
 local popped=3
 local hints=3
 local function callothersubr()
  if version=="cff" then
   if trace_charstrings then
    showstate("callothersubr")
   end
   if stack[top]==hints then
    popped=stack[top-2]
   else
    popped=3
   end
   local t=stack[top-1]
   if t then
    top=top-(t+2)
    if top<0 then
     top=0
    end
   else
    top=0
   end
  else
   top=0
  end
 end
 local function pop()
  if version=="cff" then
   if trace_charstrings then
    showstate("pop")
   end
   top=top+1
   stack[top]=popped
  else
   top=0
  end
 end
 local function setcurrentpoint()
  if version=="cff" then
   if trace_charstrings then
    showstate("setcurrentpoint (unsupported)")
   end
   x=x+stack[top-1]
   y=y+stack[top]
  end
  top=0
 end
 local reginit=false
 local function updateregions(n) 
  if regions then
   local current=regions[n+1] or regions[1]
   nofregions=#current
   if axis and n~=reginit then
    factors={}
    for i=1,nofregions do
     local region=current[i]
     local s=1
     for j=1,#axis do
      local f=axis[j]
      local r=region[j]
      local start=r.start
      local peak=r.peak
      local stop=r.stop
      if start>peak or peak>stop then
      elseif start<0 and stop>0 and peak~=0 then
      elseif peak==0 then
      elseif f<start or f>stop then
       s=0
       break
      elseif f<peak then
       s=s*(f-start)/(peak-start)
      elseif f>peak then
       s=s*(stop-f)/(stop-peak)
      else
      end
     end
     factors[i]=s
    end
   end
  end
  reginit=n
 end
 local function setvsindex()
  local vsindex=stack[top]
  if trace_charstrings then
   showstate(formatters["vsindex %i"](vsindex))
  end
  updateregions(vsindex)
  top=top-1
 end
 local function blend()
  local n=stack[top]
  top=top-1
  if axis then
   if trace_charstrings then
    local t=top-nofregions*n
    local m=t-n
    for i=1,n do
     local k=m+i
     local d=m+n+(i-1)*nofregions
     local old=stack[k]
     local new=old
     for r=1,nofregions do
      new=new+stack[d+r]*factors[r]
     end
     stack[k]=new
     showstate(formatters["blend %i of %i: %s -> %s"](i,n,old,new))
    end
    top=t
   elseif n==1 then
    top=top-nofregions
    local v=stack[top]
    for r=1,nofregions do
     v=v+stack[top+r]*factors[r]
    end
    stack[top]=v
   else
    top=top-nofregions*n
    local d=top
    local k=top-n
    for i=1,n do
     k=k+1
     local v=stack[k]
     for r=1,nofregions do
      v=v+stack[d+r]*factors[r]
     end
     stack[k]=v
     d=d+nofregions
    end
   end
  else
   top=top-nofregions*n
  end
 end
 local actions={ [0]=unsupported,
  getstem,
  unsupported,
  getstem,
  vmoveto,
  rlineto,
  hlineto,
  vlineto,
  rrcurveto,
  unsupported,
  unsupported,
  unsupported,
  unsupported,
  hsbw,
  unsupported,
  setvsindex,
  blend,
  unsupported,
  getstem,
  getmask,
  getmask,
  rmoveto,
  hmoveto,
  getstem,
  rcurveline,
  rlinecurve,
  vvcurveto,
  hhcurveto,
  unsupported,
  unsupported,
  vhcurveto,
  hvcurveto,
 }
 local reverse={ [0]="unsupported",
  "getstem",
  "unsupported",
  "getstem",
  "vmoveto",
  "rlineto",
  "hlineto",
  "vlineto",
  "rrcurveto",
  "unsupported",
  "unsupported",
  "unsupported",
  "unsupported",
  "hsbw",
  "unsupported",
  "setvsindex",
  "blend",
  "unsupported",
  "getstem",
  "getmask",
  "getmask",
  "rmoveto",
  "hmoveto",
  "getstem",
  "rcurveline",
  "rlinecurve",
  "vvcurveto",
  "hhcurveto",
  "unsupported",
  "unsupported",
  "vhcurveto",
  "hvcurveto",
 }
 local subactions={
  [000]=dotsection,
  [001]=getstem3,
  [002]=getstem3,
  [006]=seac,
  [007]=sbw,
  [012]=divide,
  [016]=callothersubr,
  [017]=pop,
  [033]=setcurrentpoint,
  [034]=hflex,
  [035]=flex,
  [036]=hflex1,
  [037]=flex1,
 }
 local chars=setmetatableindex(function (t,k)
  local v=char(k)
  t[k]=v
  return v
 end)
 local c_endchar=chars[14]
 local encode={}
 setmetatableindex(encode,function(t,i)
  for i=-2048,-1130 do
   t[i]=char(28,band(rshift(i,8),0xFF),band(i,0xFF))
  end
  for i=-1131,-108 do
   local v=0xFB00-i-108
   t[i]=char(band(rshift(v,8),0xFF),band(v,0xFF))
  end
  for i=-107,107 do
   t[i]=chars[i+139]
  end
  for i=108,1131 do
   local v=0xF700+i-108
   t[i]=char(extract(v,8,8),extract(v,0,8))
  end
  for i=1132,2048 do
   t[i]=char(28,band(rshift(i,8),0xFF),band(i,0xFF))
  end
  setmetatableindex(encode,function(t,k)
   local r=round(k)
   local v=rawget(t,r)
   if v then
    return v
   end
   local v1=floor(k)
   local v2=floor((k-v1)*0x10000)
   return char(255,extract(v1,8,8),extract(v1,0,8),extract(v2,8,8),extract(v2,0,8))
  end)
  return t[i]
 end)
 readers.cffencoder=encode
 local function p_setvsindex()
  local vsindex=stack[top]
  updateregions(vsindex)
  top=top-1
 end
 local function p_blend()
  local n=stack[top]
  top=top-1
  if not axis then
  elseif n==1 then
   top=top-nofregions
   local v=stack[top]
   for r=1,nofregions do
    v=v+stack[top+r]*factors[r]
   end
   stack[top]=round(v)
  else
   top=top-nofregions*n
   local d=top
   local k=top-n
   for i=1,n do
    k=k+1
    local v=stack[k]
    for r=1,nofregions do
     v=v+stack[d+r]*factors[r]
    end
    stack[k]=round(v)
    d=d+nofregions
   end
  end
 end
 local function p_getstem()
  local n=0
  if top%2~=0 then
   n=1
  end
  if top>n then
   stems=stems+idiv(top-n,2)
  end
 end
 local function p_getmask()
  local n=0
  if top%2~=0 then
   n=1
  end
  if top>n then
   stems=stems+idiv(top-n,2)
  end
  if stems==0 then
   return 0
  elseif stems<=8 then
   return 1
  else
   return idiv(stems+7,8)
  end
 end
 local process
 local function call(scope,list,bias) 
  depth=depth+1
  if top==0 then
   showstate(formatters["unknown %s call %s, case %s"](scope,"?",1))
   top=0
  else
   local index=stack[top]+bias
   top=top-1
   if trace_charstrings then
    showvalue(scope,index,true)
   end
   local tab=list[index]
   if tab then
    process(tab)
   else
    showstate(formatters["unknown %s call %s, case %s"](scope,index,2))
    top=0
   end
  end
  depth=depth-1
 end
 process=function(tab)
  local i=1
  local n=#tab
  while i<=n do
   local t=tab[i]
   if t>=32 then
    top=top+1
    if t<=246 then
     stack[top]=t-139
     i=i+1
    elseif t<=250 then
     stack[top]=t*256-63124+tab[i+1]
     i=i+2
    elseif t<=254 then
     stack[top]=-t*256+64148-tab[i+1]
     i=i+2
    else
     local n1=0x100*tab[i+1]+tab[i+2]
     local n2=0x100*tab[i+3]+tab[i+4]
     if n1>=0x8000 then
      n1=n1-0x10000
     end
     stack[top]=n1+n2/0xFFFF
     i=i+5
    end
   elseif t==28 then
    top=top+1
    local n=0x100*tab[i+1]+tab[i+2]
    if n>=0x8000 then
     stack[top]=n-0x10000
    else
     stack[top]=n
    end
    i=i+3
   elseif t==11 then 
    if trace_charstrings then
     showstate("return")
    end
    return
   elseif t==10 then
    call("local",locals,localbias) 
    i=i+1
   elseif t==14 then 
    if width then
    elseif top>0 then
     width=stack[1]
     if trace_charstrings then
      showvalue("width",width)
     end
    else
     width=true
    end
    if trace_charstrings then
     showstate("endchar")
    end
    return
   elseif t==29 then
    call("global",globals,globalbias) 
    i=i+1
   elseif t==12 then
    i=i+1
    local t=tab[i]
    if justpass then
     if t>=34 and t<=37 then 
      for i=1,top do
       r=r+1;result[r]=encode[stack[i]]
      end
      r=r+1;result[r]=chars[12]
      r=r+1;result[r]=chars[t]
      top=0
     elseif t==6 then
      seacs[procidx]={
       asb=stack[1],
       adx=stack[2],
       ady=stack[3],
       base=stack[4],
       accent=stack[5],
       width=width,
       lsb=lsb,
      }
      top=0
     else
      local a=subactions[t]
      if a then
       a(t)
      else
       top=0
      end
     end
    else
     local a=subactions[t]
     if a then
      a(t)
     else
      if trace_charstrings then
       showvalue("<subaction>",t)
      end
      top=0
     end
    end
    i=i+1
   elseif justpass then
    if t==15 then
     p_setvsindex()
     i=i+1
    elseif t==16 then
     local s=p_blend() or 0
     i=i+s+1
    elseif t==1 or t==3 or t==18 or operation==23 then
     p_getstem() 
     if version=="cff" then
      if top>0 then
       for i=1,top do
        r=r+1;result[r]=encode[stack[i]]
       end
       top=0
      end
      r=r+1;result[r]=chars[t]
     else
      top=0
     end
     i=i+1
    elseif t==19 or t==20 then
     local s=p_getmask() or 0
     if true then
      if top>0 then
       for i=1,top do
        r=r+1;result[r]=encode[stack[i]]
       end
       top=0
      end
      r=r+1;result[r]=chars[t]
      for j=1,s do
       i=i+1
       r=r+1;result[r]=chars[tab[i]]
      end
     else
      i=i+s
      top=0
     end
     i=i+1
    elseif t==9 then
     top=0
     i=i+1
    elseif t==13 then
     hsbw()
     if true then
      r=r+1;result[r]=encode[lsb]
      r=r+1;result[r]=chars[22]
     else
     end
     i=i+1
    else
     if trace_charstrings then
      showstate(reverse[t] or "<action>")
     end
     if top>0 then
      if t==8 and top>48 then
       local n=0
       for i=1,top do
        if n==48 then
         local zero=encode[0]
         local res3=result[r-3]
         local res2=result[r-2]
         local res1=result[r-1]
         local res0=result[r]
         result[r-3]=zero
         result[r-2]=zero
         r=r+1;result[r]=chars[t]
         r=r+1;result[r]=zero
         r=r+1;result[r]=zero
         r=r+1;result[r]=res3
         r=r+1;result[r]=res2
         r=r+1;result[r]=res1
         r=r+1;result[r]=res0
         n=1
        else
         n=n+1
        end
        r=r+1;result[r]=encode[stack[i]]
       end
      else
       for i=1,top do
        r=r+1;result[r]=encode[stack[i]]
       end
      end
      top=0
     end
     r=r+1;result[r]=chars[t]
     i=i+1
    end
   else
    local a=actions[t]
    if a then
     local s=a(t)
     if s then
      i=i+s+1
     else
      i=i+1
     end
    else
     if trace_charstrings then
      showstate(reverse[t] or "<action>")
     end
     top=0
     i=i+1
    end
   end
  end
 end
 local function setbias(globals,locals,nobias)
  if nobias then
   return 0,0
  else
   local g=#globals
   local l=#locals
   return
    ((g<1240 and 107) or (g<33900 and 1131) or 32768)+1,
    ((l<1240 and 107) or (l<33900 and 1131) or 32768)+1
  end
 end
 local function processshape(tab,index,hack)
  if not tab then
   glyphs[index]={
    boundingbox={ 0,0,0,0 },
    width=0,
    name=charset and charset[index] or nil,
   }
   return
  end
  tab=bytetable(tab)
  x=0
  y=0
  width=false
  lsb=0
  r=0
  top=0
  stems=0
  result={} 
  popped=3
  procidx=index
  xmin=0
  xmax=0
  ymin=0
  ymax=0
  checked=false
  if trace_charstrings then
   report("glyph: %i",index)
   report("data : % t",tab)
  end
  if regions then
   updateregions(vsindex)
  end
  process(tab)
  if hack then
   return x,y
  end
  local boundingbox={
   round(xmin),
   round(ymin),
   round(xmax),
   round(ymax),
  }
  if width==true or width==false then
   width=defaultwidth
  else
   width=nominalwidth+width
  end
  local glyph=glyphs[index] 
  if justpass then
   r=r+1
   result[r]=c_endchar
   local stream=concat(result)
result=nil
   if glyph then
    glyph.stream=stream
   else
    glyphs[index]={ stream=stream }
   end
  elseif glyph then
   glyph.segments=keepcurve~=false and result or nil
   glyph.boundingbox=boundingbox
   if not glyph.width then
    glyph.width=width
   end
   if charset and not glyph.name then
    glyph.name=charset[index]
   end
  elseif keepcurve then
   glyphs[index]={
    segments=result,
    boundingbox=boundingbox,
    width=width,
    name=charset and charset[index] or nil,
   }
result=nil
  else
   glyphs[index]={
    boundingbox=boundingbox,
    width=width,
    name=charset and charset[index] or nil,
   }
  end
  if trace_charstrings then
   report("width      : %s",tostring(width))
   report("boundingbox: % t",boundingbox)
  end
 end
 startparsing=function(fontdata,data,streams)
  reginit=false
  axis=false
  regions=data.regions
  justpass=streams==true
  popped=3
  seacs={}
  if regions then
   regions={}
   local deltas=data.deltas
   for i=1,#deltas do
    regions[i]=deltas[i].regions
   end
   axis=data.factors or false
  end
 end
 stopparsing=function(fontdata,data)
  stack={}
  glyphs=false
  result={}
  top=0
  locals=false
  globals=false
  strings=false
  popped=3
  seacs={}
 end
 local function setwidths(private)
  if not private then
   return 0,0
  end
  local privatedata=private.data
  if not privatedata then
   return 0,0
  end
  return privatedata.nominalwidthx or 0,privatedata.defaultwidthx or 0
 end
 parsecharstrings=function(fontdata,data,glphs,doshapes,tversion,streams,nobias)
  local dictionary=data.dictionaries[1]
  local charstrings=dictionary.charstrings
  keepcurve=doshapes
  version=tversion
  strings=data.strings
  globals=data.routines or {}
  locals=dictionary.subroutines or {}
  charset=dictionary.charset
  vsindex=dictionary.vsindex or 0
  glyphs=glphs or {}
  globalbias,localbias=setbias(globals,locals,nobias)
  nominalwidth,defaultwidth=setwidths(dictionary.private)
  if charstrings then
   startparsing(fontdata,data,streams)
   for index=1,#charstrings do
    processshape(charstrings[index],index-1)
   end
   if justpass and next(seacs) then
    local charset=data.dictionaries[1].charset
    if charset then
     local lookup=table.swapped(charset)
     for index,v in next,seacs do
      local bindex=lookup[standardnames[v.base]]
      local aindex=lookup[standardnames[v.accent]]
      local bglyph=bindex and glyphs[bindex]
      local aglyph=aindex and glyphs[aindex]
      if bglyph and aglyph then
       local jp=justpass
       justpass=false
       local x,y=processshape(charstrings[bindex+1],bindex,true)
       justpass=jp
       local base=bglyph.stream
       local accent=aglyph.stream
       local moveto=encode[-x-v.asb+v.adx]..chars[22]..encode[-y+v.ady]..chars[ 4]
       base=sub(base,1,#base-1)
       glyphs[index].stream=base..moveto..accent
      end
     end
    end
   end
   stopparsing(fontdata,data)
  else
   report("no charstrings")
  end
  return glyphs
 end
 parsecharstring=function(fontdata,data,dictionary,tab,glphs,index,doshapes,tversion,streams)
  keepcurve=doshapes
  version=tversion
  strings=data.strings
  globals=data.routines or {}
  locals=dictionary.subroutines or {}
  charset=false
  vsindex=dictionary.vsindex or 0
  glyphs=glphs or {}
  justpass=streams==true
  seacs={}
  globalbias,localbias=setbias(globals,locals,nobias)
  nominalwidth,defaultwidth=setwidths(dictionary.private)
  processshape(tab,index-1)
 end
end
local function readglobals(f,data,version)
 local routines=readlengths(f,version=="cff2")
 for i=1,#routines do
  routines[i]=readbytetable(f,routines[i])
 end
 data.routines=routines
end
local function readencodings(f,data)
 data.encodings={}
end
local function readcharsets(f,data,dictionary)
 local header=data.header
 local strings=data.strings
 local nofglyphs=data.nofglyphs
 local charsetoffset=dictionary.charset
 if charsetoffset and charsetoffset~=0 then
  setposition(f,header.offset+charsetoffset)
  local format=readbyte(f)
  local charset={ [0]=".notdef" }
  dictionary.charset=charset
  if format==0 then
   for i=1,nofglyphs do
    charset[i]=strings[readushort(f)]
   end
  elseif format==1 or format==2 then
   local readcount=format==1 and readbyte or readushort
   local i=1
   while i<=nofglyphs do
    local sid=readushort(f)
    local n=readcount(f)
    for s=sid,sid+n do
     charset[i]=strings[s]
     i=i+1
     if i>nofglyphs then
      break
     end
    end
   end
  else
   report("cff parser: unsupported charset format %a",format)
  end
 else
  dictionary.nocharset=true
  dictionary.charset=nil
 end
end
local function readprivates(f,data)
 local header=data.header
 local dictionaries=data.dictionaries
 local private=dictionaries[1].private
 if private then
  setposition(f,header.offset+private.offset)
  private.data=readstring(f,private.size)
 end
end
local function readlocals(f,data,dictionary,version)
 local header=data.header
 local private=dictionary.private
 if private then
  local subroutineoffset=private.data.subroutines
  if subroutineoffset~=0 then
   setposition(f,header.offset+private.offset+subroutineoffset)
   local subroutines=readlengths(f,version=="cff2")
   for i=1,#subroutines do
    subroutines[i]=readbytetable(f,subroutines[i])
   end
   dictionary.subroutines=subroutines
   private.data.subroutines=nil
  else
   dictionary.subroutines={}
  end
 else
  dictionary.subroutines={}
 end
end
local function readcharstrings(f,data,version)
 local header=data.header
 local dictionaries=data.dictionaries
 local dictionary=dictionaries[1]
 local stringtype=dictionary.charstringtype
 local offset=dictionary.charstrings
 if type(offset)~="number" then
 elseif stringtype==2 then
  setposition(f,header.offset+offset)
  local charstrings=readlengths(f,version=="cff2")
  local nofglyphs=#charstrings
  for i=1,nofglyphs do
   charstrings[i]=readstring(f,charstrings[i])
  end
  data.nofglyphs=nofglyphs
  dictionary.charstrings=charstrings
 else
  report("unsupported charstr type %i",stringtype)
  data.nofglyphs=0
  dictionary.charstrings={}
 end
end
local function readcidprivates(f,data)
 local header=data.header
 local dictionaries=data.dictionaries[1].cid.dictionaries
 for i=1,#dictionaries do
  local dictionary=dictionaries[i]
  local private=dictionary.private
  if private then
   setposition(f,header.offset+private.offset)
   private.data=readstring(f,private.size)
  end
 end
 parseprivates(data,dictionaries)
end
readers.parsecharstrings=parsecharstrings 
local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
 local dictionaries=data.dictionaries
 local dictionary=dictionaries[1]
 local cid=not dictionary.private and dictionary.cid
 readglobals(f,data,version)
 readcharstrings(f,data,version)
 if version=="cff2" then
  dictionary.charset=nil
 else
  readencodings(f,data)
  readcharsets(f,data,dictionary)
 end
 if cid then
  local fdarray=cid.fdarray
  if fdarray then
   setposition(f,data.header.offset+fdarray)
   local dictionaries=readlengths(f,version=="cff2")
   local nofdictionaries=#dictionaries
   if nofdictionaries>0 then
    for i=1,nofdictionaries do
     dictionaries[i]=readstring(f,dictionaries[i])
    end
    parsedictionaries(data,dictionaries)
    dictionary.private=dictionaries[1].private
    if nofdictionaries>1 then
     report("ignoring dictionaries > 1 in cid font")
    end
   end
  end
 end
 readprivates(f,data)
 parseprivates(data,data.dictionaries)
 readlocals(f,data,dictionary,version)
 startparsing(fontdata,data,streams)
 parsecharstrings(fontdata,data,glyphs,doshapes,version,streams)
 stopparsing(fontdata,data)
end
local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
 local header=data.header
 local dictionaries=data.dictionaries
 local dictionary=dictionaries[1]
 local cid=dictionary.cid
 local cidselect=cid and cid.fdselect
 readglobals(f,data,version)
 readcharstrings(f,data,version)
 if version~="cff2" then
  readencodings(f,data)
 end
 local charstrings=dictionary.charstrings
 local fdindex={}
 local nofglyphs=data.nofglyphs
 local maxindex=-1
 setposition(f,header.offset+cidselect)
 local format=readbyte(f)
 if format==1 then
  for i=0,nofglyphs do 
   local index=readbyte(f)
   fdindex[i]=index
   if index>maxindex then
    maxindex=index
   end
  end
 elseif format==3 then
  local nofranges=readushort(f)
  local first=readushort(f)
  local index=readbyte(f)
  while true do
   local last=readushort(f)
   if index>maxindex then
    maxindex=index
   end
   for i=first,last do
    fdindex[i]=index
   end
   if last>=nofglyphs then
    break
   else
    first=last+1
    index=readbyte(f)
   end
  end
 else
 end
 if maxindex>=0 then
  local cidarray=cid.fdarray
  if cidarray then
   setposition(f,header.offset+cidarray)
   local dictionaries=readlengths(f,version=="cff2")
   for i=1,#dictionaries do
    dictionaries[i]=readstring(f,dictionaries[i])
   end
   parsedictionaries(data,dictionaries)
   cid.dictionaries=dictionaries
   readcidprivates(f,data)
   for i=1,#dictionaries do
    readlocals(f,data,dictionaries[i],version)
   end
   startparsing(fontdata,data,streams)
   for i=1,#charstrings do
    parsecharstring(fontdata,data,dictionaries[fdindex[i]+1],charstrings[i],glyphs,i,doshapes,version,streams)
   end
   stopparsing(fontdata,data)
  else
   report("no cid array")
  end
 end
end
local gotodatatable=readers.helpers.gotodatatable
local function cleanup(data,dictionaries)
end
function readers.cff(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"cff",specification.details or specification.glyphs)
 if tableoffset then
  local header=readheader(f)
  if header.major~=1 then
   report("only version %s is supported for table %a",1,"cff")
   return
  end
  local glyphs=fontdata.glyphs
  local names=readfontnames(f)
  local dictionaries=readtopdictionaries(f)
  local strings=readstrings(f)
  local data={
   header=header,
   names=names,
   dictionaries=dictionaries,
   strings=strings,
   nofglyphs=fontdata.nofglyphs,
  }
  parsedictionaries(data,dictionaries,"cff")
  local dic=dictionaries[1]
  local cid=dic.cid
  local cffinfo={
   familyname=dic.familyname,
   fullname=dic.fullname,
   boundingbox=dic.boundingbox,
   weight=dic.weight,
   italicangle=dic.italicangle,
   underlineposition=dic.underlineposition,
   underlinethickness=dic.underlinethickness,
   defaultwidth=dic.defaultwidthx,
   nominalwidth=dic.nominalwidthx,
   monospaced=dic.monospaced,
  }
  fontdata.cidinfo=cid and {
   registry=cid.registry,
   ordering=cid.ordering,
   supplement=cid.supplement,
  }
  fontdata.cffinfo=cffinfo
  local all=specification.shapes or specification.streams or false
  if specification.glyphs or all then
   if cid and cid.fdselect then
    readfdselect(f,fontdata,data,glyphs,all,"cff",specification.streams)
   else
    readnoselect(f,fontdata,data,glyphs,all,"cff",specification.streams)
   end
  end
  local private=dic.private
  if private then
   local data=private.data
   if type(data)=="table" then
    cffinfo.defaultwidth=data.defaultwidthx or cffinfo.defaultwidth
    cffinfo.nominalwidth=data.nominalwidthx or cffinfo.nominalwidth
    cffinfo.bluevalues=data.bluevalues
    cffinfo.otherblues=data.otherblues
    cffinfo.familyblues=data.familyblues
    cffinfo.familyotherblues=data.familyotherblues
    cffinfo.bluescale=data.bluescale
    cffinfo.blueshift=data.blueshift
    cffinfo.bluefuzz=data.bluefuzz
    cffinfo.stdhw=data.stdhw
    cffinfo.stdvw=data.stdvw
   end
  end
  cleanup(data,dictionaries)
 end
end
function readers.cff2(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"cff2",specification.glyphs)
 if tableoffset then
  local header=readheader(f)
  if header.major~=2 then
   report("only version %s is supported for table %a",2,"cff2")
   return
  end
  local glyphs=fontdata.glyphs
  local dictionaries={ readstring(f,header.dsize) }
  local data={
   header=header,
   dictionaries=dictionaries,
   nofglyphs=fontdata.nofglyphs,
  }
  parsedictionaries(data,dictionaries,"cff2")
  local offset=dictionaries[1].vstore
  if offset>0 then
   local storeoffset=dictionaries[1].vstore+data.header.offset+2 
   local regions,deltas=readers.helpers.readvariationdata(f,storeoffset,factors)
   data.regions=regions
   data.deltas=deltas
  else
   data.regions={}
   data.deltas={}
  end
  data.factors=specification.factors
  local cid=data.dictionaries[1].cid
  local all=specification.shapes or specification.streams or false
  if cid and cid.fdselect then
   readfdselect(f,fontdata,data,glyphs,all,"cff2",specification.streams)
  else
   readnoselect(f,fontdata,data,glyphs,all,"cff2",specification.streams)
  end
  cleanup(data,dictionaries)
 end
end
function readers.cffcheck(filename)
 local f=io.open(filename,"rb")
 if f then
  local fontdata={
   glyphs={},
  }
  local header=readheader(f)
  if header.major~=1 then
   report("only version %s is supported for table %a",1,"cff")
   return
  end
  local names=readfontnames(f)
  local dictionaries=readtopdictionaries(f)
  local strings=readstrings(f)
  local glyphs={}
  local data={
   header=header,
   names=names,
   dictionaries=dictionaries,
   strings=strings,
   glyphs=glyphs,
   nofglyphs=0,
  }
  parsedictionaries(data,dictionaries,"cff")
  local cid=data.dictionaries[1].cid
  if cid and cid.fdselect then
   readfdselect(f,fontdata,data,glyphs,false)
  else
   readnoselect(f,fontdata,data,glyphs,false)
  end
  return data
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-cff”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ttf” feba1fdc80160343b24f89ef978e53cb] ---

if not modules then modules={} end modules ['font-ttf']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type,unpack=next,type,unpack
local band,rshift=bit32.band,bit32.rshift
local sqrt,round,abs,min,max=math.sqrt,math.round,math.abs,math.min,math.max
local char,rep=string.char,string.rep
local concat=table.concat
local idiv=number.idiv
local setmetatableindex=table.setmetatableindex
local report=logs.reporter("otf reader","ttf")
local trace_deltas=false
local readers=fonts.handlers.otf.readers
local streamreader=readers.streamreader
local setposition=streamreader.setposition
local getposition=streamreader.getposition
local skipbytes=streamreader.skip
local readbyte=streamreader.readcardinal1  
local readushort=streamreader.readcardinal2  
local readulong=streamreader.readcardinal4  
local readchar=streamreader.readinteger1   
local readshort=streamreader.readinteger2   
local read2dot14=streamreader.read2dot14  
local readinteger=streamreader.readinteger1
local readcardinaltable=streamreader.readcardinaltable
local readintegertable=streamreader.readintegertable
directives.register("fonts.streamreader",function()
 streamreader=utilities.streams
 setposition=streamreader.setposition
 getposition=streamreader.getposition
 skipbytes=streamreader.skip
 readbyte=streamreader.readcardinal1
 readushort=streamreader.readcardinal2
 readulong=streamreader.readcardinal4
 readchar=streamreader.readinteger1
 readshort=streamreader.readinteger2
 read2dot14=streamreader.read2dot14
 readinteger=streamreader.readinteger1
 readcardinaltable=streamreader.readcardinaltable
 readintegertable=streamreader.readintegertable
end)
local short=2
local ushort=2
local ulong=4
local helpers=readers.helpers
local gotodatatable=helpers.gotodatatable
local function mergecomposites(glyphs,shapes)
 local function merge(index,shape,components)
  local contours={}
  local points={}
  local nofcontours=0
  local nofpoints=0
  local offset=0
  local deltas=shape.deltas
  for i=1,#components do
   local component=components[i]
   local subindex=component.index
   local subshape=shapes[subindex]
   local subcontours=subshape.contours
   local subpoints=subshape.points
   if not subcontours then
    local subcomponents=subshape.components
    if subcomponents then
     subcontours,subpoints=merge(subindex,subshape,subcomponents)
    end
   end
   if subpoints then
    local matrix=component.matrix
    local xscale=matrix[1]
    local xrotate=matrix[2]
    local yrotate=matrix[3]
    local yscale=matrix[4]
    local xoffset=matrix[5]
    local yoffset=matrix[6]
    local count=#subpoints
    if xscale==1 and yscale==1 and xrotate==0 and yrotate==0 then
     for i=1,count do
      local p=subpoints[i]
      nofpoints=nofpoints+1
      points[nofpoints]={
       p[1]+xoffset,
       p[2]+yoffset,
       p[3]
      }
     end
    else
     for i=1,count do
      local p=subpoints[i]
      local x=p[1]
      local y=p[2]
      nofpoints=nofpoints+1
      points[nofpoints]={
       xscale*x+xrotate*y+xoffset,
       yscale*y+yrotate*x+yoffset,
       p[3]
      }
     end
    end
    local subcount=#subcontours
    if subcount==1 then
     nofcontours=nofcontours+1
     contours[nofcontours]=offset+subcontours[1]
    else
     for i=1,#subcontours do
      nofcontours=nofcontours+1
      contours[nofcontours]=offset+subcontours[i]
     end
    end
    offset=offset+count
   else
    report("missing contours composite %s, component %s of %s, glyph %s",index,i,#components,subindex)
   end
  end
  shape.points=points 
  shape.contours=contours
  shape.components=nil
  return contours,points
 end
 for index=0,#glyphs do
  local shape=shapes[index]
  if shape then
   local components=shape.components
   if components then
    merge(index,shape,components)
   end
  end
 end
end
local function readnothing(f)
 return {
  type="nothing",
 }
end
local function curveto(m_x,m_y,l_x,l_y,r_x,r_y) 
 return
  l_x+2/3*(m_x-l_x),l_y+2/3*(m_y-l_y),
  r_x+2/3*(m_x-r_x),r_y+2/3*(m_y-r_y),
  r_x,r_y,"c"
end
local xv={} 
local yv={} 
local function applyaxis(glyph,shape,deltas,dowidth)
 local points=shape.points
 if points then
  local nofpoints=#points
  local dw=0
  local dl=0
  for i=1,#deltas do
   local deltaset=deltas[i]
   local xvalues=deltaset.xvalues
   local yvalues=deltaset.yvalues
   if xvalues and yvalues then
    local dpoints=deltaset.points
    local factor=deltaset.factor
    if dpoints then
     local cnt=#dpoints
     if dowidth then
      cnt=cnt-4
     end
     if cnt==1 then
      local d=dpoints[1]
      local x=xvalues[d]*factor
      local y=yvalues[d]*factor
      for i=1,nofpoints do
       local p=points[i]
       if x~=0 then
        p[1]=p[1]+x
       end
       if y~=0 then
        p[2]=p[2]+y
       end
      end
     elseif cnt>0 then
      local function find(i)
       local prv=cnt
       for j=1,cnt do
        local nxt=dpoints[j]
        if nxt==i then
         return false,j,false
        elseif nxt>i then
         return prv,false,j
        end
        prv=j
       end
       return prv,false,1
      end
      for i=1,nofpoints do
       local d1,d2,d3=find(i)
       local p2=points[i]
       if d2 then
        xv[i]=xvalues[d2]
        yv[i]=yvalues[d2]
       else
        local n1=dpoints[d1]
        local n3=dpoints[d3]
        if n1>nofpoints then
         n1=nofpoints
        end
        if n3>nofpoints then
         n3=nofpoints
        end
        local p1=points[n1]
        local p3=points[n3]
        local p1x=p1[1]
        local p2x=p2[1]
        local p3x=p3[1]
        local p1y=p1[2]
        local p2y=p2[2]
        local p3y=p3[2]
        local x1=xvalues[d1]
        local y1=yvalues[d1]
        local x3=xvalues[d3]
        local y3=yvalues[d3]
        local fx
        local fy
        if p1x==p3x then
         if x1==x3 then
          fx=x1
         else
          fx=0
         end
        elseif p2x<=min(p1x,p3x) then
         if p1x<p3x then
          fx=x1
         else
          fx=x3
         end
        elseif p2x>=max(p1x,p3x) then
         if p1x>p3x then
          fx=x1
         else
          fx=x3
         end
        else
         fx=(p2x-p1x)/(p3x-p1x)
         fx=(1-fx)*x1+fx*x3
        end
        if p1y==p3y then
         if y1==y3 then
          fy=y1
         else
          fy=0
         end
        elseif p2y<=min(p1y,p3y) then
         if p1y<p3y then
          fy=y1
         else
          fy=y3
         end
        elseif p2y>=max(p1y,p3y) then
         if p1y>p3y then
          fy=y1
         else
          fy=y3
         end
        else
         fy=(p2y-p1y)/(p3y-p1y)
         fy=(1-fy)*y1+fy*y3
        end
        xv[i]=fx
        yv[i]=fy
       end
      end
      for i=1,nofpoints do
       local pi=points[i]
       local fx=xv[i]
       local fy=yv[i]
       if fx~=0 then
        pi[1]=pi[1]+factor*fx
       end
       if fy~=0 then
        pi[2]=pi[2]+factor*fy
       end
      end
     else
      report("bad deltapoint data, maybe a missing hvar table")
     end
    else
     for i=1,nofpoints do
      local p=points[i]
      local x=xvalues[i]
      if x then
       local y=yvalues[i]
       if x~=0 then
        p[1]=p[1]+factor*x
       end
       if y~=0 then
        p[2]=p[2]+factor*y
       end
      else
       break
      end
     end
    end
    if dowidth then
     local h=nofpoints+2 
     local l=nofpoints+1
     local x=xvalues[h]
     if x then
      dw=dw+factor*x
     end
     local x=xvalues[l]
     if x then
      dl=dl+factor*x
     end
    end
   end
  end
  if dowidth then
   local width=glyph.width or 0
   glyph.width=width+dw-dl
  end
 else
  report("no points for glyph %a",glyph.name)
 end
end
local quadratic=false
local function contours2outlines_normal(glyphs,shapes)
 for index=0,#glyphs-1 do
  local shape=shapes[index]
  if shape then
   local glyph=glyphs[index]
   local contours=shape.contours
   local points=shape.points
   if contours then
    local nofcontours=#contours
    local segments={}
    local nofsegments=0
    glyph.segments=segments
    if nofcontours>0 then
     local px=0
     local py=0
     local first=1
     for i=1,nofcontours do
      local last=contours[i]
      if last>=first then
       local first_pt=points[first]
       local first_on=first_pt[3]
       if first==last then
        first_pt[3]="m" 
        nofsegments=nofsegments+1
        segments[nofsegments]=first_pt
       else 
        local first_on=first_pt[3]
        local last_pt=points[last]
        local last_on=last_pt[3]
        local start=1
        local control_pt=false
        if first_on then
         start=2
        else
         if last_on then
          first_pt=last_pt
         else
          first_pt={ (first_pt[1]+last_pt[1])/2,(first_pt[2]+last_pt[2])/2,false }
         end
         control_pt=first_pt
        end
        local x=first_pt[1]
        local y=first_pt[2]
        if not done then
         xmin=x
         ymin=y
         xmax=x
         ymax=y
         done=true
        end
        nofsegments=nofsegments+1
        segments[nofsegments]={ x,y,"m" } 
        if not quadratic then
         px=x
         py=y
        end
        local previous_pt=first_pt
        for i=first,last do
         local current_pt=points[i]
         local current_on=current_pt[3]
         local previous_on=previous_pt[3]
         if previous_on then
          if current_on then
           local x,y=current_pt[1],current_pt[2]
           nofsegments=nofsegments+1
           segments[nofsegments]={ x,y,"l" } 
           if not quadratic then
            px,py=x,y
           end
          else
           control_pt=current_pt
          end
         elseif current_on then
          local x1=control_pt[1]
          local y1=control_pt[2]
          local x2=current_pt[1]
          local y2=current_pt[2]
          nofsegments=nofsegments+1
          if quadratic then
           segments[nofsegments]={ x1,y1,x2,y2,"q" } 
          else
           x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
           segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" } 
          end
          control_pt=false
         else
          local x2=(previous_pt[1]+current_pt[1])/2
          local y2=(previous_pt[2]+current_pt[2])/2
          local x1=control_pt[1]
          local y1=control_pt[2]
          nofsegments=nofsegments+1
          if quadratic then
           segments[nofsegments]={ x1,y1,x2,y2,"q" } 
          else
           x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
           segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" } 
          end
          control_pt=current_pt
         end
         previous_pt=current_pt
        end
        if first_pt==last_pt then
        else
         nofsegments=nofsegments+1
         local x2=first_pt[1]
         local y2=first_pt[2]
         if not control_pt then
          segments[nofsegments]={ x2,y2,"l" } 
         elseif quadratic then
          local x1=control_pt[1]
          local y1=control_pt[2]
          segments[nofsegments]={ x1,y1,x2,y2,"q" } 
         else
          local x1=control_pt[1]
          local y1=control_pt[2]
          x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
          segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" }
         end
        end
       end
      end
      first=last+1
     end
    end
   end
  end
 end
end
local function contours2outlines_shaped(glyphs,shapes,keepcurve)
 for index=0,#glyphs-1 do
  local shape=shapes[index]
  if shape then
   local glyph=glyphs[index]
   local contours=shape.contours
   local points=shape.points
   if contours then
    local nofcontours=#contours
    local segments=keepcurve and {} or nil
    local nofsegments=0
    if keepcurve then
     glyph.segments=segments
    end
    if nofcontours>0 then
     local xmin,ymin,xmax,ymax,done=0,0,0,0,false
     local px,py=0,0 
     local first=1
     for i=1,nofcontours do
      local last=contours[i]
      if last>=first then
       local first_pt=points[first]
       local first_on=first_pt[3]
       if first==last then
        if keepcurve then
         first_pt[3]="m" 
         nofsegments=nofsegments+1
         segments[nofsegments]=first_pt
        end
       else 
        local first_on=first_pt[3]
        local last_pt=points[last]
        local last_on=last_pt[3]
        local start=1
        local control_pt=false
        if first_on then
         start=2
        else
         if last_on then
          first_pt=last_pt
         else
          first_pt={ (first_pt[1]+last_pt[1])/2,(first_pt[2]+last_pt[2])/2,false }
         end
         control_pt=first_pt
        end
        local x=first_pt[1]
        local y=first_pt[2]
        if not done then
         xmin,ymin,xmax,ymax=x,y,x,y
         done=true
        else
         if x<xmin then xmin=x elseif x>xmax then xmax=x end
         if y<ymin then ymin=y elseif y>ymax then ymax=y end
        end
        if keepcurve then
         nofsegments=nofsegments+1
         segments[nofsegments]={ x,y,"m" } 
        end
        if not quadratic then
         px=x
         py=y
        end
        local previous_pt=first_pt
        for i=first,last do
         local current_pt=points[i]
         local current_on=current_pt[3]
         local previous_on=previous_pt[3]
         if previous_on then
          if current_on then
           local x=current_pt[1]
           local y=current_pt[2]
           if x<xmin then xmin=x elseif x>xmax then xmax=x end
           if y<ymin then ymin=y elseif y>ymax then ymax=y end
           if keepcurve then
            nofsegments=nofsegments+1
            segments[nofsegments]={ x,y,"l" } 
           end
           if not quadratic then
            px=x
            py=y
           end
          else
           control_pt=current_pt
          end
         elseif current_on then
          local x1=control_pt[1]
          local y1=control_pt[2]
          local x2=current_pt[1]
          local y2=current_pt[2]
          if quadratic then
           if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
           if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
           if keepcurve then
            nofsegments=nofsegments+1
            segments[nofsegments]={ x1,y1,x2,y2,"q" } 
           end
          else
           x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
           if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
           if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
           if x2<xmin then xmin=x2 elseif x2>xmax then xmax=x2 end
           if y2<ymin then ymin=y2 elseif y2>ymax then ymax=y2 end
           if px<xmin then xmin=px elseif px>xmax then xmax=px end
           if py<ymin then ymin=py elseif py>ymax then ymax=py end
           if keepcurve then
            nofsegments=nofsegments+1
            segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" } 
           end
          end
          control_pt=false
         else
          local x2=(previous_pt[1]+current_pt[1])/2
          local y2=(previous_pt[2]+current_pt[2])/2
          local x1=control_pt[1]
          local y1=control_pt[2]
          if quadratic then
           if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
           if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
           if keepcurve then
            nofsegments=nofsegments+1
            segments[nofsegments]={ x1,y1,x2,y2,"q" } 
           end
          else
           x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
           if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
           if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
           if x2<xmin then xmin=x2 elseif x2>xmax then xmax=x2 end
           if y2<ymin then ymin=y2 elseif y2>ymax then ymax=y2 end
           if px<xmin then xmin=px elseif px>xmax then xmax=px end
           if py<ymin then ymin=py elseif py>ymax then ymax=py end
           if keepcurve then
            nofsegments=nofsegments+1
            segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" } 
           end
          end
          control_pt=current_pt
         end
         previous_pt=current_pt
        end
        if first_pt==last_pt then
        elseif not control_pt then
         if keepcurve then
          nofsegments=nofsegments+1
          segments[nofsegments]={ first_pt[1],first_pt[2],"l" } 
         end
        else
         local x1=control_pt[1]
         local y1=control_pt[2]
         local x2=first_pt[1]
         local y2=first_pt[2]
         if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
         if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
         if quadratic then
          if keepcurve then
           nofsegments=nofsegments+1
           segments[nofsegments]={ x1,y1,x2,y2,"q" } 
          end
         else
          x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
          if x2<xmin then xmin=x2 elseif x2>xmax then xmax=x2 end
          if y2<ymin then ymin=y2 elseif y2>ymax then ymax=y2 end
          if px<xmin then xmin=px elseif px>xmax then xmax=px end
          if py<ymin then ymin=py elseif py>ymax then ymax=py end
          if keepcurve then
           nofsegments=nofsegments+1
           segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" } 
          end
         end
        end
       end
      end
      first=last+1
     end
     glyph.boundingbox={ round(xmin),round(ymin),round(xmax),round(ymax) }
    end
   end
  end
 end
end
local c_zero=char(0)
local s_zero=char(0,0)
local function toushort(n)
 return char(band(rshift(n,8),0xFF),band(n,0xFF))
end
local function toshort(n)
 if n<0 then
  n=n+0x10000
 end
 return char(band(rshift(n,8),0xFF),band(n,0xFF))
end
local chars=setmetatableindex(function(t,k)
 for i=0,255 do local v=char(i) t[i]=v end return t[k]
end)
local function repackpoints(glyphs,shapes)
 local noboundingbox={ 0,0,0,0 }
 local result={} 
 local xpoints={} 
 local ypoints={} 
 for index=0,#glyphs do
  local shape=shapes[index]
  if shape then
   local r=0
   local glyph=glyphs[index]
   local contours=shape.contours
   local nofcontours=contours and #contours or 0
   local boundingbox=glyph.boundingbox or noboundingbox
   r=r+1 result[r]=toshort(nofcontours)
   r=r+1 result[r]=toshort(boundingbox[1]) 
   r=r+1 result[r]=toshort(boundingbox[2]) 
   r=r+1 result[r]=toshort(boundingbox[3]) 
   r=r+1 result[r]=toshort(boundingbox[4]) 
   if nofcontours>0 then
    for i=1,nofcontours do
     r=r+1 result[r]=toshort(contours[i]-1)
    end
    r=r+1 result[r]=s_zero 
    local points=shape.points
    local currentx=0
    local currenty=0
    local x=0
    local y=0
    local lastflag=nil
    local nofflags=0
    for i=1,#points do
     local pt=points[i]
     local px=pt[1]
     local py=pt[2]
     local fl=pt[3] and 0x01 or 0x00
     if px==currentx then
      fl=fl+0x10
     else
      local dx=round(px-currentx)
      x=x+1
      if dx<-255 or dx>255 then
       xpoints[x]=toshort(dx)
      elseif dx<0 then
       fl=fl+0x02
       xpoints[x]=chars[-dx]
      elseif dx>0 then
       fl=fl+0x12
       xpoints[x]=chars[dx]
      else
       fl=fl+0x02
       xpoints[x]=c_zero
      end
     end
     if py==currenty then
      fl=fl+0x20
     else
      local dy=round(py-currenty)
      y=y+1
      if dy<-255 or dy>255 then
       ypoints[y]=toshort(dy)
      elseif dy<0 then
       fl=fl+0x04
       ypoints[y]=chars[-dy]
      elseif dy>0 then
       fl=fl+0x24
       ypoints[y]=chars[dy]
      else
       fl=fl+0x04
       ypoints[y]=c_zero
      end
     end
     currentx=px
     currenty=py
     if lastflag==fl then
      if nofflags==255 then
       lastflag=lastflag+0x08
       r=r+1 result[r]=char(lastflag,nofflags-1)
       nofflags=1
       lastflag=fl
      else
       nofflags=nofflags+1
      end
     else 
      if nofflags==1 then
       r=r+1 result[r]=chars[lastflag]
      elseif nofflags==2 then
       r=r+1 result[r]=char(lastflag,lastflag)
      elseif nofflags>2 then
       lastflag=lastflag+0x08
       r=r+1 result[r]=char(lastflag,nofflags-1)
      end
      nofflags=1
      lastflag=fl
     end
    end
    if nofflags==1 then
     r=r+1 result[r]=chars[lastflag]
    elseif nofflags==2 then
     r=r+1 result[r]=char(lastflag,lastflag)
    elseif nofflags>2 then
     lastflag=lastflag+0x08
     r=r+1 result[r]=char(lastflag,nofflags-1)
    end
    r=r+1 result[r]=concat(xpoints,"",1,x)
    r=r+1 result[r]=concat(ypoints,"",1,y)
   end
   local stream=concat(result,"",1,r)
   local length=#stream
   local padding=idiv(length+3,4)*4-length
   if padding>0 then
    if padding==1 then
     padding="\0"
    elseif padding==2 then
     padding="\0\0"
    else
     padding="\0\0\0"
    end
    padding=stream..padding
   end
   glyph.stream=stream
  end
 end
end
local flags={}
local function readglyph(f,nofcontours) 
 local points={}
 local contours={} 
 for i=1,nofcontours do
  contours[i]=readshort(f)+1
 end
 local nofpoints=contours[nofcontours]
 local nofinstructions=readushort(f)
 skipbytes(f,nofinstructions)
 local i=1
 while i<=nofpoints do
  local flag=readbyte(f)
  flags[i]=flag
  if band(flag,0x08)~=0 then
   local n=readbyte(f)
   if n==1 then
    i=i+1
    flags[i]=flag
   else
    for j=1,n do
     i=i+1
     flags[i]=flag
    end
   end
  end
  i=i+1
 end
 local x=0
 for i=1,nofpoints do
  local flag=flags[i]
  if band(flag,0x02)~=0 then
   if band(flag,0x10)~=0 then
    x=x+readbyte(f)
   else
    x=x-readbyte(f)
   end
  elseif band(flag,0x10)~=0 then
  else
   x=x+readshort(f)
  end
  points[i]={ x,0,band(flag,0x01)~=0 }
 end
 local y=0
 for i=1,nofpoints do
  local flag=flags[i]
  if band(flag,0x04)~=0 then
   if band(flag,0x20)~=0 then
    y=y+readbyte(f)
   else
    y=y-readbyte(f)
   end
  elseif band(flag,0x20)~=0 then
  else
   y=y+readshort(f)
  end
  points[i][2]=y
 end
 return {
  type="glyph",
  points=points,
  contours=contours,
  nofpoints=nofpoints,
 }
end
local function readcomposite(f)
 local components={}
 local nofcomponents=0
 local instructions=false
 while true do
  local flags=readushort(f)
  local index=readushort(f)
  local f_xyarg=band(flags,0x0002)~=0
  local f_offset=band(flags,0x0800)~=0
  local xscale=1
  local xrotate=0
  local yrotate=0
  local yscale=1
  local xoffset=0
  local yoffset=0
  local base=false
  local reference=false
  if f_xyarg then
   if band(flags,0x0001)~=0 then 
    xoffset=readshort(f)
    yoffset=readshort(f)
   else
    xoffset=readchar(f) 
    yoffset=readchar(f) 
   end
  else
   if band(flags,0x0001)~=0 then 
    base=readshort(f)
    reference=readshort(f)
   else
    base=readchar(f) 
    reference=readchar(f) 
   end
  end
  if band(flags,0x0008)~=0 then 
   xscale=read2dot14(f)
   yscale=xscale
   if f_xyarg and f_offset then
    xoffset=xoffset*xscale
    yoffset=yoffset*yscale
   end
  elseif band(flags,0x0040)~=0 then 
   xscale=read2dot14(f)
   yscale=read2dot14(f)
   if f_xyarg and f_offset then
    xoffset=xoffset*xscale
    yoffset=yoffset*yscale
   end
  elseif band(flags,0x0080)~=0 then 
   xscale=read2dot14(f) 
   xrotate=read2dot14(f) 
   yrotate=read2dot14(f) 
   yscale=read2dot14(f) 
   if f_xyarg and f_offset then
    xoffset=xoffset*sqrt(xscale^2+yrotate^2) 
    yoffset=yoffset*sqrt(xrotate^2+yscale^2) 
   end
  end
  nofcomponents=nofcomponents+1
  components[nofcomponents]={
   index=index,
   usemine=band(flags,0x0200)~=0,
   round=band(flags,0x0006)~=0,
   base=base,
   reference=reference,
   matrix={ xscale,xrotate,yrotate,yscale,xoffset,yoffset },
  }
  if band(flags,0x0100)~=0 then
   instructions=true
  end
  if band(flags,0x0020)==0 then 
   break
  end
 end
 return {
  type="composite",
  components=components,
 }
end
function readers.loca(f,fontdata,specification)
 if specification.glyphs then
  local datatable=fontdata.tables.loca
  if datatable then
   local offset=fontdata.tables.glyf.offset
   local format=fontdata.fontheader.indextolocformat
   local profile=fontdata.maximumprofile
   local nofglyphs=profile and profile.nofglyphs
   local locations={}
   setposition(f,datatable.offset)
   if format==1 then
    if not nofglyphs then
     nofglyphs=idiv(datatable.length,4)-1
    end
    for i=0,nofglyphs do
     locations[i]=offset+readulong(f)
    end
    fontdata.nofglyphs=nofglyphs
   else
    if not nofglyphs then
     nofglyphs=idiv(datatable.length,2)-1
    end
    for i=0,nofglyphs do
     locations[i]=offset+readushort(f)*2
    end
   end
   fontdata.nofglyphs=nofglyphs
   fontdata.locations=locations
  end
 end
end
function readers.glyf(f,fontdata,specification) 
 local tableoffset=gotodatatable(f,fontdata,"glyf",specification.glyphs)
 if tableoffset then
  local locations=fontdata.locations
  if locations then
   local glyphs=fontdata.glyphs
   local nofglyphs=fontdata.nofglyphs
   local filesize=fontdata.filesize
   local nothing={ 0,0,0,0 }
   local shapes={}
   local loadshapes=specification.shapes or specification.instance or specification.streams
   for index=0,nofglyphs-1 do
    local location=locations[index]
    local length=locations[index+1]-location
    if location>=filesize then
     report("discarding %s glyphs due to glyph location bug",nofglyphs-index+1)
     fontdata.nofglyphs=index-1
     fontdata.badfont=true
     break
    elseif length>0 then
     setposition(f,location)
     local nofcontours=readshort(f)
     glyphs[index].boundingbox={
      readshort(f),
      readshort(f),
      readshort(f),
      readshort(f),
     }
     if not loadshapes then
     elseif nofcontours==0 then
      shapes[index]=readnothing(f)
     elseif nofcontours>0 then
      shapes[index]=readglyph(f,nofcontours)
     else
      shapes[index]=readcomposite(f,nofcontours)
     end
    else
     if loadshapes then
      shapes[index]=readnothing(f)
     end
     glyphs[index].boundingbox=nothing
    end
   end
   if loadshapes then
    if readers.gvar then
     readers.gvar(f,fontdata,specification,glyphs,shapes)
    end
    mergecomposites(glyphs,shapes)
    if specification.instance then
     if specification.streams then
      repackpoints(glyphs,shapes)
     else
      contours2outlines_shaped(glyphs,shapes,specification.shapes)
     end
    elseif specification.shapes then
     if specification.streams then
      repackpoints(glyphs,shapes)
     else
      contours2outlines_normal(glyphs,shapes)
     end
    elseif specification.streams then
     repackpoints(glyphs,shapes)
    end
   end
  end
 end
end
local function readtuplerecord(f,nofaxis)
 local record={}
 for i=1,nofaxis do
  record[i]=read2dot14(f)
 end
 return record
end
local function readpoints(f)
 local count=readbyte(f)
 if count==0 then
  return nil,0 
 else
  if count<128 then
  elseif band(count,0x80)~=0 then
   count=band(count,0x7F)*256+readbyte(f)
  else
  end
  local points={}
  local p=0
  local n=1 
  while p<count do
   local control=readbyte(f)
   local runreader=band(control,0x80)~=0 and readushort or readbyte
   local runlength=band(control,0x7F)
   for i=1,runlength+1 do
    n=n+runreader(f)
    p=p+1
    points[p]=n
   end
  end
  return points,p
 end
end
local function readdeltas(f,nofpoints)
 local deltas={}
 local p=0
 while nofpoints>0 do
  local control=readbyte(f)
  if control then
   local allzero=band(control,0x80)~=0
   local runlength=band(control,0x3F)+1
   if allzero then
    for i=1,runlength do
     p=p+1
     deltas[p]=0
    end
   else
    local runreader=band(control,0x40)~=0 and readshort or readinteger
    for i=1,runlength do
     p=p+1
     deltas[p]=runreader(f)
    end
   end
   nofpoints=nofpoints-runlength
  else
   break
  end
 end
 if p>0 then
  return deltas
 else
 end
end
function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
 local instance=specification.instance
 if not instance then
  return
 end
 local factors=specification.factors
 if not factors then
  return
 end
 local tableoffset=gotodatatable(f,fontdata,"gvar",specification.variable or specification.shapes)
 if tableoffset then
  local version=readulong(f) 
  local nofaxis=readushort(f)
  local noftuples=readushort(f)
  local tupleoffset=tableoffset+readulong(f)
  local nofglyphs=readushort(f)
  local flags=readushort(f)
  local dataoffset=tableoffset+readulong(f)
  local data={}
  local tuples={}
  local glyphdata=fontdata.glyphs
  local dowidth=not fontdata.variabledata.hvarwidths
  if band(flags,0x0001)~=0  then
   for i=1,nofglyphs+1 do
    data[i]=dataoffset+readulong(f)
   end
  else
   for i=1,nofglyphs+1 do
    data[i]=dataoffset+2*readushort(f)
   end
  end
  if noftuples>0 then
   setposition(f,tupleoffset)
   for i=1,noftuples do
    tuples[i]=readtuplerecord(f,nofaxis)
   end
  end
  local nextoffset=false
  local startoffset=data[1]
  for i=1,nofglyphs do 
   nextoffset=data[i+1]
   local glyph=glyphdata[i-1]
   local name=trace_deltas and glyph.name
   if startoffset==nextoffset then
    if name then
     report("no deltas for glyph %a",name)
    end
   else
    local shape=shapedata[i-1] 
    if not shape then
     if name then
      report("no shape for glyph %a",name)
     end
    else
     lastoffset=startoffset
     setposition(f,startoffset)
     local flags=readushort(f)
     local count=band(flags,0x0FFF)
     local offset=startoffset+readushort(f) 
     local deltas={}
     local allpoints=(shape.nofpoints or 0) 
     local shared=false
     local nofshared=0
     if band(flags,0x8000)~=0  then
      local current=getposition(f)
      setposition(f,offset)
      shared,nofshared=readpoints(f)
      offset=getposition(f)
      setposition(f,current)
     end
     for j=1,count do
      local size=readushort(f) 
      local flags=readushort(f)
      local index=band(flags,0x0FFF)
      local haspeak=band(flags,0x8000)~=0
      local intermediate=band(flags,0x4000)~=0
      local private=band(flags,0x2000)~=0
      local peak=nil
      local start=nil
      local stop=nil
      local xvalues=nil
      local yvalues=nil
      local points=shared 
      local nofpoints=nofshared
      if haspeak then
       peak=readtuplerecord(f,nofaxis)
      else
       if index+1>#tuples then
        report("error, bad tuple index",index)
       end
       peak=tuples[index+1] 
      end
      if intermediate then
       start=readtuplerecord(f,nofaxis)
       stop=readtuplerecord(f,nofaxis)
      end
      if size>0 then
       local current=getposition(f)
       setposition(f,offset)
       if private then
        points,nofpoints=readpoints(f)
       end 
       if nofpoints==0 then
        nofpoints=allpoints+4
       end
       if nofpoints>0 then
        xvalues=readdeltas(f,nofpoints)
        yvalues=readdeltas(f,nofpoints)
       end
       offset=offset+size
       setposition(f,current)
      end
      if not xvalues and not yvalues then
       points=nil
      end
      local s=1
      for i=1,nofaxis do
       local f=factors[i]
       local peak=peak  and peak [i] or 0
       local start=start and start[i] or (peak<0 and peak or 0)
       local stop=stop  and stop [i] or (peak>0 and peak or 0)
       if start>peak or peak>stop then
       elseif start<0 and stop>0 and peak~=0 then
       elseif peak==0 then
       elseif f<start or f>stop then
        s=0
        break
       elseif f<peak then
        s=s*(f-start)/(peak-start)
       elseif f>peak then
        s=s*(stop-f)/(stop-peak)
       else
       end
      end
      if s==0 then
       if name then
        report("no deltas applied for glyph %a",name)
       end
      else
       deltas[#deltas+1]={
        factor=s,
        points=points,
        xvalues=xvalues,
        yvalues=yvalues,
       }
      end
     end
     if shape.type=="glyph" then
      applyaxis(glyph,shape,deltas,dowidth)
     else
      shape.deltas=deltas
     end
    end
   end
   startoffset=nextoffset
  end
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ttf”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-dsp” 7616dae672693fd8ec0f1892358019a2] ---

if not modules then modules={} end modules ['font-dsp']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type,tonumber=next,type,tonumber
local band=bit32.band
local extract=bit32.extract
local bor=bit32.bor
local lshift=bit32.lshift
local rshift=bit32.rshift
local gsub=string.gsub
local lower=string.lower
local sub=string.sub
local strip=string.strip
local tohash=table.tohash
local concat=table.concat
local copy=table.copy
local reversed=table.reversed
local sort=table.sort
local insert=table.insert
local round=math.round
local settings_to_hash=utilities.parsers.settings_to_hash_colon_too
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local sortedkeys=table.sortedkeys
local sortedhash=table.sortedhash
local sequenced=table.sequenced
local report=logs.reporter("otf reader")
local readers=fonts.handlers.otf.readers
local streamreader=readers.streamreader
local setposition=streamreader.setposition
local getposition=streamreader.getposition
local readuinteger=streamreader.readcardinal1
local readushort=streamreader.readcardinal2
local readulong=streamreader.readcardinal4
local readinteger=streamreader.readinteger1
local readshort=streamreader.readinteger2
local readstring=streamreader.readstring
local readtag=streamreader.readtag
local readbytes=streamreader.readbytes
local readfixed=streamreader.readfixed4
local read2dot14=streamreader.read2dot14
local skipshort=streamreader.skipshort
local skipbytes=streamreader.skip
local readbytetable=streamreader.readbytetable
local readbyte=streamreader.readbyte
local readcardinaltable=streamreader.readcardinaltable
local readintegertable=streamreader.readintegertable
local readfword=readshort
local short=2
local ushort=2
local ulong=4
directives.register("fonts.streamreader",function()
 streamreader=utilities.streams
 setposition=streamreader.setposition
 getposition=streamreader.getposition
 readuinteger=streamreader.readcardinal1
 readushort=streamreader.readcardinal2
 readulong=streamreader.readcardinal4
 readinteger=streamreader.readinteger1
 readshort=streamreader.readinteger2
 readstring=streamreader.readstring
 readtag=streamreader.readtag
 readbytes=streamreader.readbytes
 readfixed=streamreader.readfixed4
 read2dot14=streamreader.read2dot14
 skipshort=streamreader.skipshort
 skipbytes=streamreader.skip
 readbytetable=streamreader.readbytetable
 readbyte=streamreader.readbyte
 readcardinaltable=streamreader.readcardinaltable
 readintegertable=streamreader.readintegertable
 readfword=readshort
end)
local gsubhandlers={}
local gposhandlers={}
readers.gsubhandlers=gsubhandlers
readers.gposhandlers=gposhandlers
local helpers=readers.helpers
local gotodatatable=helpers.gotodatatable
local setvariabledata=helpers.setvariabledata
local lookupidoffset=-1 
local classes={
 "base",
 "ligature",
 "mark",
 "component",
}
local gsubtypes={
 "single",
 "multiple",
 "alternate",
 "ligature",
 "context",
 "chainedcontext",
 "extension",
 "reversechainedcontextsingle",
}
local gpostypes={
 "single",
 "pair",
 "cursive",
 "marktobase",
 "marktoligature",
 "marktomark",
 "context",
 "chainedcontext",
 "extension",
}
local chaindirections={
 context=0,
 chainedcontext=1,
 reversechainedcontextsingle=-1,
}
local function setmetrics(data,where,tag,d)
 local w=data[where]
 if w then
  local v=w[tag]
  if v then
   w[tag]=v+d
  end
 end
end
local variabletags={
 hasc=function(data,d) setmetrics(data,"windowsmetrics","typoascender",d) end,
 hdsc=function(data,d) setmetrics(data,"windowsmetrics","typodescender",d) end,
 hlgp=function(data,d) setmetrics(data,"windowsmetrics","typolinegap",d) end,
 hcla=function(data,d) setmetrics(data,"windowsmetrics","winascent",d) end,
 hcld=function(data,d) setmetrics(data,"windowsmetrics","windescent",d) end,
 vasc=function(data,d) setmetrics(data,"vhea not done","ascent",d) end,
 vdsc=function(data,d) setmetrics(data,"vhea not done","descent",d) end,
 vlgp=function(data,d) setmetrics(data,"vhea not done","linegap",d) end,
 xhgt=function(data,d) setmetrics(data,"windowsmetrics","xheight",d) end,
 cpht=function(data,d) setmetrics(data,"windowsmetrics","capheight",d) end,
 sbxs=function(data,d) setmetrics(data,"windowsmetrics","subscriptxsize",d) end,
 sbys=function(data,d) setmetrics(data,"windowsmetrics","subscriptysize",d) end,
 sbxo=function(data,d) setmetrics(data,"windowsmetrics","subscriptxoffset",d) end,
 sbyo=function(data,d) setmetrics(data,"windowsmetrics","subscriptyoffset",d) end,
 spxs=function(data,d) setmetrics(data,"windowsmetrics","superscriptxsize",d) end,
 spys=function(data,d) setmetrics(data,"windowsmetrics","superscriptysize",d) end,
 spxo=function(data,d) setmetrics(data,"windowsmetrics","superscriptxoffset",d) end,
 spyo=function(data,d) setmetrics(data,"windowsmetrics","superscriptyoffset",d) end,
 strs=function(data,d) setmetrics(data,"windowsmetrics","strikeoutsize",d) end,
 stro=function(data,d) setmetrics(data,"windowsmetrics","strikeoutpos",d) end,
 unds=function(data,d) setmetrics(data,"postscript","underlineposition",d) end,
 undo=function(data,d) setmetrics(data,"postscript","underlinethickness",d) end,
}
local read_cardinal={
 streamreader.readcardinal1,
 streamreader.readcardinal2,
 streamreader.readcardinal3,
 streamreader.readcardinal4,
}
local read_integer={
 streamreader.readinteger1,
 streamreader.readinteger2,
 streamreader.readinteger3,
 streamreader.readinteger4,
}
local lookupnames={
 gsub={
  single="gsub_single",
  multiple="gsub_multiple",
  alternate="gsub_alternate",
  ligature="gsub_ligature",
  context="gsub_context",
  chainedcontext="gsub_contextchain",
  reversechainedcontextsingle="gsub_reversecontextchain",
 },
 gpos={
  single="gpos_single",
  pair="gpos_pair",
  cursive="gpos_cursive",
  marktobase="gpos_mark2base",
  marktoligature="gpos_mark2ligature",
  marktomark="gpos_mark2mark",
  context="gpos_context",
  chainedcontext="gpos_contextchain",
 }
}
local lookupflags=setmetatableindex(function(t,k)
 local v={
  band(k,0x0008)~=0 and true or false,
  band(k,0x0004)~=0 and true or false,
  band(k,0x0002)~=0 and true or false,
  band(k,0x0001)~=0 and true or false,
 }
 t[k]=v
 return v
end)
local function axistofactors(str)
 local t=settings_to_hash(str)
 for k,v in next,t do
  t[k]=tonumber(v) or v 
 end
 return t
end
local hash=table.setmetatableindex(function(t,k)
 local v=sequenced(axistofactors(k),",")
 t[k]=v
 return v
end)
helpers.normalizedaxishash=hash
local cleanname=fonts.names and fonts.names.cleanname or function(name)
 return name and (gsub(lower(name),"[^%a%d]","")) or nil
end
helpers.cleanname=cleanname
function helpers.normalizedaxis(str)
 return hash[str] or str
end
local function getaxisscale(segments,minimum,default,maximum,user)
 if not minimum or not default or not maximum then
  return false
 end
 if user<minimum then
  user=minimum
 elseif user>maximum then
  user=maximum
 end
 if user<default then
  default=- (default-user)/(default-minimum)
 elseif user>default then
  default=(user-default)/(maximum-default)
 else
  default=0
 end
 if not segments then
  return default
 end
 local e
 for i=1,#segments do
  local s=segments[i]
  if type(s)~="number" then
   report("using default axis scale")
   return default
  elseif s[1]>=default then
   if s[2]==default then
    return default
   else
    e=i
    break
   end
  end
 end
 if e then
  local b=segments[e-1]
  local e=segments[e]
  return b[2]+(e[2]-b[2])*(default-b[1])/(e[1]-b[1])
 else
  return false
 end
end
local function getfactors(data,instancespec)
 if instancespec==true then
 elseif type(instancespec)~="string" or instancespec=="" then
  return
 end
 local variabledata=data.variabledata
 if not variabledata then
  return
 end
 local instances=variabledata.instances
 local axis=variabledata.axis
 local segments=variabledata.segments
 if instances and axis then
  local values
  if instancespec==true then
   values={}
   for i=1,#axis do
    values[i]={
     value=axis[i].default,
    }
   end
  else
   for i=1,#instances do
    local instance=instances[i]
    if cleanname(instance.subfamily)==instancespec then
     values=instance.values
     break
    end
   end
  end
  if values then
   local factors={}
   for i=1,#axis do
    local a=axis[i]
    factors[i]=getaxisscale(segments,a.minimum,a.default,a.maximum,values[i].value)
   end
   return factors
  end
  local values=axistofactors(hash[instancespec] or instancespec)
  if values then
   local factors={}
   for i=1,#axis do
    local a=axis[i]
    local d=a.default
    factors[i]=getaxisscale(segments,a.minimum,d,a.maximum,values[a.name or a.tag] or d)
   end
   return factors
  end
 end
end
local function getscales(regions,factors)
 local scales={}
 for i=1,#regions do
  local region=regions[i]
  local s=1
  for j=1,#region do
   local axis=region[j]
   local f=factors[j]
   local start=axis.start
   local peak=axis.peak
   local stop=axis.stop
   if start>peak or peak>stop then
   elseif start<0 and stop>0 and peak~=0 then
   elseif peak==0 then
   elseif f<start or f>stop then
    s=0
    break
   elseif f<peak then
    s=s*(f-start)/(peak-start)
   elseif f>peak then
    s=s*(stop-f)/(stop-peak)
   else
   end
  end
  scales[i]=s
 end
 return scales
end
helpers.getaxisscale=getaxisscale
helpers.getfactors=getfactors
helpers.getscales=getscales
helpers.axistofactors=axistofactors
local function readvariationdata(f,storeoffset,factors) 
 local position=getposition(f)
 setposition(f,storeoffset)
 local format=readushort(f)
 local regionoffset=storeoffset+readulong(f)
 local nofdeltadata=readushort(f)
 local deltadata=readcardinaltable(f,nofdeltadata,ulong)
 setposition(f,regionoffset)
 local nofaxis=readushort(f)
 local nofregions=readushort(f)
 local regions={}
 for i=1,nofregions do 
  local t={}
  for i=1,nofaxis do
   t[i]={ 
    start=read2dot14(f),
    peak=read2dot14(f),
    stop=read2dot14(f),
   }
  end
  regions[i]=t
 end
  for i=1,nofdeltadata do
   setposition(f,storeoffset+deltadata[i])
   local nofdeltasets=readushort(f)
   local nofshorts=readushort(f)
   local nofregions=readushort(f)
   local usedregions={}
   local deltas={}
   for i=1,nofregions do
    usedregions[i]=regions[readushort(f)+1]
   end
   for i=1,nofdeltasets do
    local t=readintegertable(f,nofshorts,short)
    for i=nofshorts+1,nofregions do
     t[i]=readinteger(f)
    end
    deltas[i]=t
   end
   deltadata[i]={
    regions=usedregions,
    deltas=deltas,
    scales=factors and getscales(usedregions,factors) or nil,
   }
  end
 setposition(f,position)
 return regions,deltadata
end
helpers.readvariationdata=readvariationdata
local function readcoverage(f,offset,simple)
 setposition(f,offset)
 local coverageformat=readushort(f)
 if coverageformat==1 then
  local nofcoverage=readushort(f)
  if simple then
   if nofcoverage==1 then
    return { readushort(f) }
   elseif nofcoverage==2 then
    return { readushort(f),readushort(f) }
   else
    return readcardinaltable(f,nofcoverage,ushort)
   end
  elseif nofcoverage==1 then
   return { [readushort(f)]=0 }
  elseif nofcoverage==2 then
   return { [readushort(f)]=0,[readushort(f)]=1 }
  else
   local coverage={}
   for i=0,nofcoverage-1 do
    coverage[readushort(f)]=i 
   end
   return coverage
  end
 elseif coverageformat==2 then
  local nofranges=readushort(f)
  local coverage={}
  local n=simple and 1 or 0 
  for i=1,nofranges do
   local firstindex=readushort(f)
   local lastindex=readushort(f)
   local coverindex=readushort(f)
   if simple then
    for i=firstindex,lastindex do
     coverage[n]=i
     n=n+1
    end
   else
    for i=firstindex,lastindex do
     coverage[i]=n
     n=n+1
    end
   end
  end
  return coverage
 else
  report("unknown coverage format %a ",coverageformat)
  return {}
 end
end
local function readclassdef(f,offset,preset)
 setposition(f,offset)
 local classdefformat=readushort(f)
 local classdef={}
 if type(preset)=="number" then
  for k=0,preset-1 do
   classdef[k]=1
  end
 end
 if classdefformat==1 then
  local index=readushort(f)
  local nofclassdef=readushort(f)
  for i=1,nofclassdef do
   classdef[index]=readushort(f)+1
   index=index+1
  end
 elseif classdefformat==2 then
  local nofranges=readushort(f)
  local n=0
  for i=1,nofranges do
   local firstindex=readushort(f)
   local lastindex=readushort(f)
   local class=readushort(f)+1
   for i=firstindex,lastindex do
    classdef[i]=class
   end
  end
 else
  report("unknown classdef format %a ",classdefformat)
 end
 if type(preset)=="table" then
  for k in next,preset do
   if not classdef[k] then
    classdef[k]=1
   end
  end
 end
 return classdef
end
local function classtocoverage(defs)
 if defs then
  local list={}
  for index,class in next,defs do
   local c=list[class]
   if c then
    c[#c+1]=index
   else
    list[class]={ index }
   end
  end
  return list
 end
end
local skips={ [0]=0,
 1,
 1,
 2,
 1,
 2,
 2,
 3,
 2,
 2,
 3,
 2,
 3,
 3,
 4,
}
local function readvariation(f,offset)
 local p=getposition(f)
 setposition(f,offset)
 local outer=readushort(f)
 local inner=readushort(f)
 local format=readushort(f)
 setposition(f,p)
 if format==0x8000 then
  return outer,inner
 end
end
local function readposition(f,format,mainoffset,getdelta)
 if format==0 then
  return false
 end
 if format==0x04 then
  local h=readshort(f)
  if h==0 then
   return true 
  else
   return { 0,0,h,0 }
  end
 end
 if format==0x05 then
  local x=readshort(f)
  local h=readshort(f)
  if x==0 and h==0 then
   return true 
  else
   return { x,0,h,0 }
  end
 end
 if format==0x44 then
  local h=readshort(f)
  if getdelta then
   local d=readshort(f) 
   if d>0 then
    local outer,inner=readvariation(f,mainoffset+d)
    if outer then
     h=h+getdelta(outer,inner)
    end
   end
  else
   skipshort(f,1)
  end
  if h==0 then
   return true 
  else
   return { 0,0,h,0 }
  end
 end
 local x=band(format,0x1)~=0 and readshort(f) or 0 
 local y=band(format,0x2)~=0 and readshort(f) or 0 
 local h=band(format,0x4)~=0 and readshort(f) or 0 
 local v=band(format,0x8)~=0 and readshort(f) or 0 
 if format>=0x10 then
  local X=band(format,0x10)~=0 and skipshort(f) or 0
  local Y=band(format,0x20)~=0 and skipshort(f) or 0
  local H=band(format,0x40)~=0 and skipshort(f) or 0
  local V=band(format,0x80)~=0 and skipshort(f) or 0
  local s=skips[extract(format,4,4)]
  if s>0 then
   skipshort(f,s)
  end
  if getdelta then
   if X>0 then
    local outer,inner=readvariation(f,mainoffset+X)
    if outer then
     x=x+getdelta(outer,inner)
    end
   end
   if Y>0 then
    local outer,inner=readvariation(f,mainoffset+Y)
    if outer then
     y=y+getdelta(outer,inner)
    end
   end
   if H>0 then
    local outer,inner=readvariation(f,mainoffset+H)
    if outer then
     h=h+getdelta(outer,inner)
    end
   end
   if V>0 then
    local outer,inner=readvariation(f,mainoffset+V)
    if outer then
     v=v+getdelta(outer,inner)
    end
   end
  end
  return { x,y,h,v }
 elseif x==0 and y==0 and h==0 and v==0 then
  return true 
 else
  return { x,y,h,v }
 end
end
local function readanchor(f,offset,getdelta) 
 if not offset or offset==0 then
  return nil 
 end
 setposition(f,offset)
 local format=readshort(f) 
 local x=readshort(f)
 local y=readshort(f)
 if format==3 then
  if getdelta then
   local X=readshort(f)
   local Y=readshort(f)
   if X>0 then
    local outer,inner=readvariation(f,offset+X)
    if outer then
     x=x+getdelta(outer,inner)
    end
   end
   if Y>0 then
    local outer,inner=readvariation(f,offset+Y)
    if outer then
     y=y+getdelta(outer,inner)
    end
   end
  else
   skipshort(f,2)
  end
  return { x,y } 
 else
  return { x,y }
 end
end
local function readfirst(f,offset)
 if offset then
  setposition(f,offset)
 end
 return { readushort(f) }
end
local function readarray(f,offset)
 if offset then
  setposition(f,offset)
 end
 local n=readushort(f)
 if n==1 then
  return { readushort(f) },1
 elseif n>0 then
  return readcardinaltable(f,n,ushort),n
 end
end
local function readcoveragearray(f,offset,t,simple)
 if not t then
  return nil
 end
 local n=#t
 if n==0 then
  return nil
 end
 for i=1,n do
  t[i]=readcoverage(f,offset+t[i],simple)
 end
 return t
end
local function covered(subset,all)
 local used,u
 for i=1,#subset do
  local s=subset[i]
  if all[s] then
   if used then
    u=u+1
    used[u]=s
   else
    u=1
    used={ s }
   end
  end
 end
 return used
end
local function readlookuparray(f,noflookups,nofcurrent)
 local lookups={}
 if noflookups>0 then
  local length=0
  for i=1,noflookups do
   local index=readushort(f)+1
   if index>length then
    length=index
   end
   local lookup=readushort(f)+1
   local list=lookups[index]
   if list then
    list[#list+1]=lookup
   else
    lookups[index]={ lookup }
   end
  end
  for index=1,length do
   if not lookups[index] then
    lookups[index]=false
   end
  end
 end
 return lookups
end
local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,what)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local coverage=readushort(f)
  local subclasssets=readarray(f)
  local rules={}
  if subclasssets then
   coverage=readcoverage(f,tableoffset+coverage,true)
   for i=1,#subclasssets do
    local offset=subclasssets[i]
    if offset>0 then
     local firstcoverage=coverage[i]
     local rulesoffset=tableoffset+offset
     local subclassrules=readarray(f,rulesoffset)
     for rule=1,#subclassrules do
      setposition(f,rulesoffset+subclassrules[rule])
      local nofcurrent=readushort(f)
      local noflookups=readushort(f)
      local current={ { firstcoverage } }
      for i=2,nofcurrent do
       current[i]={ readushort(f) }
      end
      local lookups=readlookuparray(f,noflookups,nofcurrent)
      rules[#rules+1]={
       current=current,
       lookups=lookups
      }
     end
    end
   end
  else
   report("empty subclassset in %a subtype %i","unchainedcontext",subtype)
  end
  return {
   format="glyphs",
   rules=rules,
  }
 elseif subtype==2 then
  local coverage=readushort(f)
  local currentclassdef=readushort(f)
  local subclasssets=readarray(f)
  local rules={}
  if subclasssets then
   coverage=readcoverage(f,tableoffset+coverage)
   currentclassdef=readclassdef(f,tableoffset+currentclassdef,coverage)
   local currentclasses=classtocoverage(currentclassdef,fontdata.glyphs)
   for class=1,#subclasssets do
    local offset=subclasssets[class]
    if offset>0 then
     local firstcoverage=currentclasses[class]
     if firstcoverage then
      firstcoverage=covered(firstcoverage,coverage) 
      if firstcoverage then
       local rulesoffset=tableoffset+offset
       local subclassrules=readarray(f,rulesoffset)
       for rule=1,#subclassrules do
        setposition(f,rulesoffset+subclassrules[rule])
        local nofcurrent=readushort(f)
        local noflookups=readushort(f)
        local current={ firstcoverage }
        for i=2,nofcurrent do
         current[i]=currentclasses[readushort(f)+1]
        end
        local lookups=readlookuparray(f,noflookups,nofcurrent)
        rules[#rules+1]={
         current=current,
         lookups=lookups
        }
       end
      else
       report("no coverage")
      end
     else
      report("no coverage class")
     end
    end
   end
  else
   report("empty subclassset in %a subtype %i","unchainedcontext",subtype)
  end
  return {
   format="class",
   rules=rules,
  }
 elseif subtype==3 then
  local nofglyphs=readushort(f)
  local noflookups=readushort(f)
  local current=readcardinaltable(f,nofglyphs,ushort)
  local lookups=readlookuparray(f,noflookups,#current)
  current=readcoveragearray(f,tableoffset,current,true)
  return {
   format="coverage",
   rules={
    {
     current=current,
     lookups=lookups,
    }
   }
  }
 else
  report("unsupported subtype %a in %a %s",subtype,"unchainedcontext",what)
 end
end
local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,what)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local coverage=readushort(f)
  local subclasssets=readarray(f)
  local rules={}
  if subclasssets then
   coverage=readcoverage(f,tableoffset+coverage,true)
   for i=1,#subclasssets do
    local offset=subclasssets[i]
    if offset>0 then
     local firstcoverage=coverage[i]
     local rulesoffset=tableoffset+offset
     local subclassrules=readarray(f,rulesoffset)
     for rule=1,#subclassrules do
      setposition(f,rulesoffset+subclassrules[rule])
      local nofbefore=readushort(f)
      local before
      if nofbefore>0 then
       before={}
       for i=1,nofbefore do
        before[i]={ readushort(f) }
       end
      end
      local nofcurrent=readushort(f)
      local current={ { firstcoverage } }
      for i=2,nofcurrent do
       current[i]={ readushort(f) }
      end
      local nofafter=readushort(f)
      local after
      if nofafter>0 then
       after={}
       for i=1,nofafter do
        after[i]={ readushort(f) }
       end
      end
      local noflookups=readushort(f)
      local lookups=readlookuparray(f,noflookups,nofcurrent)
      rules[#rules+1]={
       before=before,
       current=current,
       after=after,
       lookups=lookups,
      }
     end
    end
   end
  else
   report("empty subclassset in %a subtype %i","chainedcontext",subtype)
  end
  return {
   format="glyphs",
   rules=rules,
  }
 elseif subtype==2 then
  local coverage=readushort(f)
  local beforeclassdef=readushort(f)
  local currentclassdef=readushort(f)
  local afterclassdef=readushort(f)
  local subclasssets=readarray(f)
  local rules={}
  if subclasssets then
   local coverage=readcoverage(f,tableoffset+coverage)
   local beforeclassdef=readclassdef(f,tableoffset+beforeclassdef,nofglyphs)
   local currentclassdef=readclassdef(f,tableoffset+currentclassdef,coverage)
   local afterclassdef=readclassdef(f,tableoffset+afterclassdef,nofglyphs)
   local beforeclasses=classtocoverage(beforeclassdef,fontdata.glyphs)
   local currentclasses=classtocoverage(currentclassdef,fontdata.glyphs)
   local afterclasses=classtocoverage(afterclassdef,fontdata.glyphs)
   for class=1,#subclasssets do
    local offset=subclasssets[class]
    if offset>0 then
     local firstcoverage=currentclasses[class]
     if firstcoverage then
      firstcoverage=covered(firstcoverage,coverage) 
      if firstcoverage then
       local rulesoffset=tableoffset+offset
       local subclassrules=readarray(f,rulesoffset)
       for rule=1,#subclassrules do
        setposition(f,rulesoffset+subclassrules[rule])
        local nofbefore=readushort(f)
        local before
        if nofbefore>0 then
         before={}
         for i=1,nofbefore do
          before[i]=beforeclasses[readushort(f)+1]
         end
        end
        local nofcurrent=readushort(f)
        local current={ firstcoverage }
        for i=2,nofcurrent do
         current[i]=currentclasses[readushort(f)+1]
        end
        local nofafter=readushort(f)
        local after
        if nofafter>0 then
         after={}
         for i=1,nofafter do
          after[i]=afterclasses[readushort(f)+1]
         end
        end
        local noflookups=readushort(f)
        local lookups=readlookuparray(f,noflookups,nofcurrent)
        rules[#rules+1]={
         before=before,
         current=current,
         after=after,
         lookups=lookups,
        }
       end
      else
       report("no coverage")
      end
     else
      report("class is not covered")
     end
    end
   end
  else
   report("empty subclassset in %a subtype %i","chainedcontext",subtype)
  end
  return {
   format="class",
   rules=rules,
  }
 elseif subtype==3 then
  local before=readarray(f)
  local current=readarray(f)
  local after=readarray(f)
  local noflookups=readushort(f)
  local lookups=readlookuparray(f,noflookups,#current)
  before=readcoveragearray(f,tableoffset,before,true)
  current=readcoveragearray(f,tableoffset,current,true)
  after=readcoveragearray(f,tableoffset,after,true)
  return {
   format="coverage",
   rules={
    {
     before=before,
     current=current,
     after=after,
     lookups=lookups,
    }
   }
  }
 else
  report("unsupported subtype %a in %a %s",subtype,"chainedcontext",what)
 end
end
local function extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,types,handlers,what)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local lookuptype=types[readushort(f)]
  local faroffset=readulong(f)
  local handler=handlers[lookuptype]
  if handler then
   return handler(f,fontdata,lookupid,tableoffset+faroffset,0,glyphs,nofglyphs),lookuptype
  else
   report("no handler for lookuptype %a subtype %a in %s %s",lookuptype,subtype,what,"extension")
  end
 else
  report("unsupported subtype %a in %s %s",subtype,what,"extension")
 end
end
function gsubhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local coverage=readushort(f)
  local delta=readshort(f) 
  local coverage=readcoverage(f,tableoffset+coverage) 
  for index in next,coverage do
   local newindex=(index+delta)%65536 
   if index>nofglyphs or newindex>nofglyphs then
    report("invalid index in %s format %i: %i -> %i (max %i)","single",subtype,index,newindex,nofglyphs)
    coverage[index]=nil
   else
    coverage[index]=newindex
   end
  end
  return {
   coverage=coverage
  }
 elseif subtype==2 then 
  local coverage=readushort(f)
  local nofreplacements=readushort(f)
  local replacements=readcardinaltable(f,nofreplacements,ushort)
  local coverage=readcoverage(f,tableoffset+coverage) 
  for index,newindex in next,coverage do
   newindex=newindex+1
   if index>nofglyphs or newindex>nofglyphs then
    report("invalid index in %s format %i: %i -> %i (max %i)","single",subtype,index,newindex,nofglyphs)
    coverage[index]=nil
   else
    coverage[index]=replacements[newindex]
   end
  end
  return {
   coverage=coverage
  }
 else
  report("unsupported subtype %a in %a substitution",subtype,"single")
 end
end
local function sethandler(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,what)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local coverage=readushort(f)
  local nofsequence=readushort(f)
  local sequences=readcardinaltable(f,nofsequence,ushort)
  for i=1,nofsequence do
   setposition(f,tableoffset+sequences[i])
   sequences[i]=readcardinaltable(f,readushort(f),ushort)
  end
  local coverage=readcoverage(f,tableoffset+coverage)
  for index,newindex in next,coverage do
   newindex=newindex+1
   if index>nofglyphs or newindex>nofglyphs then
    report("invalid index in %s format %i: %i -> %i (max %i)",what,subtype,index,newindex,nofglyphs)
    coverage[index]=nil
   else
    coverage[index]=sequences[newindex]
   end
  end
  return {
   coverage=coverage
  }
 else
  report("unsupported subtype %a in %a substitution",subtype,what)
 end
end
function gsubhandlers.multiple(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return sethandler(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"multiple")
end
function gsubhandlers.alternate(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return sethandler(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"alternate")
end
function gsubhandlers.ligature(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then
  local coverage=readushort(f)
  local nofsets=readushort(f)
  local ligatures=readcardinaltable(f,nofsets,ushort)
  for i=1,nofsets do
   local offset=lookupoffset+offset+ligatures[i]
   setposition(f,offset)
   local n=readushort(f)
   if n==1 then
    ligatures[i]={ offset+readushort(f) }
   else
    local l={}
    for i=1,n do
     l[i]=offset+readushort(f)
    end
    ligatures[i]=l
   end
  end
  local coverage=readcoverage(f,tableoffset+coverage)
  for index,newindex in next,coverage do
   local hash={}
   local ligatures=ligatures[newindex+1]
   for i=1,#ligatures do
    local offset=ligatures[i]
    setposition(f,offset)
    local lig=readushort(f)
    local cnt=readushort(f)
    local hsh=hash
    for i=2,cnt do
     local c=readushort(f)
     local h=hsh[c]
     if not h then
      h={}
      hsh[c]=h
     end
     hsh=h
    end
    hsh.ligature=lig
   end
   coverage[index]=hash
  end
  return {
   coverage=coverage
  }
 else
  report("unsupported subtype %a in %a substitution",subtype,"ligature")
 end
end
function gsubhandlers.context(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"substitution"),"context"
end
function gsubhandlers.chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"substitution"),"chainedcontext"
end
function gsubhandlers.extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,gsubtypes,gsubhandlers,"substitution")
end
function gsubhandlers.reversechainedcontextsingle(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 if subtype==1 then 
  local current=readfirst(f)
  local before=readarray(f)
  local after=readarray(f)
  local replacements=readarray(f)
  current=readcoveragearray(f,tableoffset,current,true)
  before=readcoveragearray(f,tableoffset,before,true)
  after=readcoveragearray(f,tableoffset,after,true)
  return {
   format="reversecoverage",
   rules={
    {
     before=before,
     current=current,
     after=after,
     replacements=replacements,
    }
   }
  },"reversechainedcontextsingle"
 else
  report("unsupported subtype %a in %a substitution",subtype,"reversechainedcontextsingle")
 end
end
local function readpairsets(f,tableoffset,sets,format1,format2,mainoffset,getdelta)
 local done={}
 for i=1,#sets do
  local offset=sets[i]
  local reused=done[offset]
  if not reused then
   offset=tableoffset+offset
   setposition(f,offset)
   local n=readushort(f)
   reused={}
   for i=1,n do
    reused[i]={
     readushort(f),
     readposition(f,format1,offset,getdelta),
     readposition(f,format2,offset,getdelta),
    }
   end
   done[offset]=reused
  end
  sets[i]=reused
 end
 return sets
end
local function readpairclasssets(f,nofclasses1,nofclasses2,format1,format2,mainoffset,getdelta)
 local classlist1={}
 for i=1,nofclasses1 do
  local classlist2={}
  classlist1[i]=classlist2
  for j=1,nofclasses2 do
   local one=readposition(f,format1,mainoffset,getdelta)
   local two=readposition(f,format2,mainoffset,getdelta)
   if one or two then
    classlist2[j]={ one,two }
   else
    classlist2[j]=false
   end
  end
 end
 return classlist1
end
function gposhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 local getdelta=fontdata.temporary.getdelta
 if subtype==1 then
  local coverage=readushort(f)
  local format=readushort(f)
  local value=readposition(f,format,tableoffset,getdelta)
  local coverage=readcoverage(f,tableoffset+coverage)
  for index,newindex in next,coverage do
   coverage[index]=value 
  end
  return {
   format="single",
   coverage=coverage,
  }
 elseif subtype==2 then
  local coverage=readushort(f)
  local format=readushort(f)
  local nofvalues=readushort(f)
  local values={}
  for i=1,nofvalues do
   values[i]=readposition(f,format,tableoffset,getdelta)
  end
  local coverage=readcoverage(f,tableoffset+coverage)
  for index,newindex in next,coverage do
   coverage[index]=values[newindex+1]
  end
  return {
   format="single",
   coverage=coverage,
  }
 else
  report("unsupported subtype %a in %a positioning",subtype,"single")
 end
end
function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 local getdelta=fontdata.temporary.getdelta
 if subtype==1 then
  local coverage=readushort(f)
  local format1=readushort(f)
  local format2=readushort(f)
  local sets=readarray(f)
     sets=readpairsets(f,tableoffset,sets,format1,format2,mainoffset,getdelta)
     coverage=readcoverage(f,tableoffset+coverage)
  local shared={} 
  for index,newindex in next,coverage do
   local set=sets[newindex+1]
   local hash={}
   for i=1,#set do
    local value=set[i]
    if value then
     local other=value[1]
     local share=shared[value]
     if share==nil then
      local first=value[2]
      local second=value[3]
      if first or second then
       share={ first,second or nil } 
      else
       share=false
      end
      shared[value]=share
     end
     hash[other]=share or nil 
    end
   end
   coverage[index]=hash
  end
  return {
   shared=shared and true or nil,
   format="pair",
   coverage=coverage,
  }
 elseif subtype==2 then
  local coverage=readushort(f)
  local format1=readushort(f)
  local format2=readushort(f)
  local classdef1=readushort(f)
  local classdef2=readushort(f)
  local nofclasses1=readushort(f) 
  local nofclasses2=readushort(f) 
  local classlist=readpairclasssets(f,nofclasses1,nofclasses2,format1,format2,tableoffset,getdelta)
     coverage=readcoverage(f,tableoffset+coverage)
     classdef1=readclassdef(f,tableoffset+classdef1,coverage)
     classdef2=readclassdef(f,tableoffset+classdef2,nofglyphs)
  local usedcoverage={}
  local shared={} 
  for g1,c1 in next,classdef1 do
   if coverage[g1] then
    local l1=classlist[c1]
    if l1 then
     local hash={}
     for paired,class in next,classdef2 do
      local offsets=l1[class]
      if offsets then
       local first=offsets[1]
       local second=offsets[2]
       if first or second then
        local s1=shared[first]
        if s1==nil then
         s1={}
         shared[first]=s1
        end
        local s2=s1[second]
        if s2==nil then
         s2={ first,second or nil }
         s1[second]=s2
        end
        hash[paired]=s2
       end
      end
     end
     usedcoverage[g1]=hash
    end
   end
  end
  return {
   shared=shared and true or nil,
   format="pair",
   coverage=usedcoverage,
  }
 elseif subtype==3 then
  report("yet unsupported subtype %a in %a positioning",subtype,"pair")
 else
  report("unsupported subtype %a in %a positioning",subtype,"pair")
 end
end
function gposhandlers.cursive(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 local getdelta=fontdata.temporary.getdelta
 if subtype==1 then
  local coverage=tableoffset+readushort(f)
  local nofrecords=readushort(f)
  local records={}
  for i=1,nofrecords do
   local entry=readushort(f)
   local exit=readushort(f)
   records[i]={
    entry~=0 and (tableoffset+entry) or false,
    exit~=0 and (tableoffset+exit ) or nil,
   }
  end
  local cc=(fontdata.temporary.cursivecount or 0)+1
  fontdata.temporary.cursivecount=cc
  cc="cc-"..cc
  coverage=readcoverage(f,coverage)
  for i=1,nofrecords do
   local r=records[i]
   records[i]={
    cc,
    readanchor(f,r[1],getdelta) or false,
    readanchor(f,r[2],getdelta) or nil,
   }
  end
  for index,newindex in next,coverage do
   coverage[index]=records[newindex+1]
  end
  return {
   coverage=coverage,
  }
 else
  report("unsupported subtype %a in %a positioning",subtype,"cursive")
 end
end
local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,ligature)
 local tableoffset=lookupoffset+offset
 setposition(f,tableoffset)
 local subtype=readushort(f)
 local getdelta=fontdata.temporary.getdelta
 if subtype==1 then
  local markcoverage=tableoffset+readushort(f)
  local basecoverage=tableoffset+readushort(f)
  local nofclasses=readushort(f)
  local markoffset=tableoffset+readushort(f)
  local baseoffset=tableoffset+readushort(f)
  local markcoverage=readcoverage(f,markcoverage)
  local basecoverage=readcoverage(f,basecoverage,true)
  setposition(f,markoffset)
  local markclasses={}
  local nofmarkclasses=readushort(f)
  local lastanchor=fontdata.lastanchor or 0
  local usedanchors={}
  for i=1,nofmarkclasses do
   local class=readushort(f)+1
   local offset=readushort(f)
   if offset==0 then
    markclasses[i]=false
   else
    markclasses[i]={ class,markoffset+offset }
   end
   usedanchors[class]=true
  end
  for i=1,nofmarkclasses do
   local mc=markclasses[i]
   if mc then
    mc[2]=readanchor(f,mc[2],getdelta)
   end
  end
  setposition(f,baseoffset)
  local nofbaserecords=readushort(f)
  local baserecords={}
  if ligature then
   for i=1,nofbaserecords do 
    local offset=readushort(f)
    if offset==0 then
     baserecords[i]=false
    else
     baserecords[i]=baseoffset+offset
    end
   end
   for i=1,nofbaserecords do
    local recordoffset=baserecords[i]
    if recordoffset then
     setposition(f,recordoffset)
     local nofcomponents=readushort(f)
     local components={}
     for i=1,nofcomponents do
      local classes={}
      for i=1,nofclasses do
       local offset=readushort(f)
       if offset~=0 then
        classes[i]=recordoffset+offset
       else
        classes[i]=false
       end
      end
      components[i]=classes
     end
     baserecords[i]=components
    end
   end
   local baseclasses={} 
   for i=1,nofclasses do
    baseclasses[i]={}
   end
   for i=1,nofbaserecords do
    local components=baserecords[i]
    if components then
     local b=basecoverage[i]
     for c=1,#components do
      local classes=components[c]
      if classes then
       for i=1,nofclasses do
        local anchor=readanchor(f,classes[i],getdelta)
        local bclass=baseclasses[i]
        local bentry=bclass[b]
        if bentry then
         bentry[c]=anchor
        else
         bclass[b]={ [c]=anchor }
        end
       end
      end
     end
    end
   end
   for index,newindex in next,markcoverage do
    markcoverage[index]=markclasses[newindex+1] or nil
   end
   return {
    format="ligature",
    baseclasses=baseclasses,
    coverage=markcoverage,
   }
  else
   for i=1,nofbaserecords do
    local r={}
    for j=1,nofclasses do
     local offset=readushort(f)
     if offset==0 then
      r[j]=false
     else
      r[j]=baseoffset+offset
     end
    end
    baserecords[i]=r
   end
   local baseclasses={} 
   for i=1,nofclasses do
    baseclasses[i]={}
   end
   for i=1,nofbaserecords do
    local r=baserecords[i]
    local b=basecoverage[i]
    for j=1,nofclasses do
     baseclasses[j][b]=readanchor(f,r[j],getdelta)
    end
   end
   for index,newindex in next,markcoverage do
    markcoverage[index]=markclasses[newindex+1] or nil
   end
   return {
    format="base",
    baseclasses=baseclasses,
    coverage=markcoverage,
   }
  end
 else
  report("unsupported subtype %a in",subtype)
 end
end
function gposhandlers.marktobase(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
end
function gposhandlers.marktoligature(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,true)
end
function gposhandlers.marktomark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
end
function gposhandlers.context(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"positioning"),"context"
end
function gposhandlers.chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,"positioning"),"chainedcontext"
end
function gposhandlers.extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs)
 return extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,gpostypes,gposhandlers,"positioning")
end
do
 local plugins={}
 function plugins.size(f,fontdata,tableoffset,feature)
  if fontdata.designsize then
  else
   local function check(offset)
    setposition(f,offset)
    local designsize=readushort(f)
    if designsize>0 then 
     local fontstyleid=readushort(f)
     local guimenuid=readushort(f)
     local minsize=readushort(f)
     local maxsize=readushort(f)
     if minsize==0 and maxsize==0 and fontstyleid==0 and guimenuid==0 then
      minsize=designsize
      maxsize=designsize
     end
     if designsize>=minsize and designsize<=maxsize then
      return minsize,maxsize,designsize
     end
    end
   end
   local minsize,maxsize,designsize=check(tableoffset+feature.offset+feature.parameters)
   if not designsize then
    minsize,maxsize,designsize=check(tableoffset+feature.parameters)
    if designsize then
     report("bad size feature in %a, falling back to wrong offset",fontdata.filename or "?")
    else
     report("bad size feature in %a,",fontdata.filename or "?")
    end
   end
   if designsize then
    fontdata.minsize=minsize
    fontdata.maxsize=maxsize
    fontdata.designsize=designsize
   end
  end
 end
 local function reorderfeatures(fontdata,scripts,features)
  local scriptlangs={}
  local featurehash={}
  local featureorder={}
  for script,languages in next,scripts do
   for language,record in next,languages do
    local hash={}
    local list=record.featureindices
    for k=1,#list do
     local index=list[k]
     local feature=features[index]
     local lookups=feature.lookups
     local tag=feature.tag
     if tag then
      hash[tag]=true
     end
     if lookups then
      for i=1,#lookups do
       local lookup=lookups[i]
       local o=featureorder[lookup]
       if o then
        local okay=true
        for i=1,#o do
         if o[i]==tag then
          okay=false
          break
         end
        end
        if okay then
         o[#o+1]=tag
        end
       else
        featureorder[lookup]={ tag }
       end
       local f=featurehash[lookup]
       if f then
        local h=f[tag]
        if h then
         local s=h[script]
         if s then
          s[language]=true
         else
          h[script]={ [language]=true }
         end
        else
         f[tag]={ [script]={ [language]=true } }
        end
       else
        featurehash[lookup]={ [tag]={ [script]={ [language]=true } } }
       end
       local h=scriptlangs[tag]
       if h then
        local s=h[script]
        if s then
         s[language]=true
        else
         h[script]={ [language]=true }
        end
       else
        scriptlangs[tag]={ [script]={ [language]=true } }
       end
      end
     end
    end
   end
  end
  return scriptlangs,featurehash,featureorder
 end
 local function readscriplan(f,fontdata,scriptoffset)
  setposition(f,scriptoffset)
  local nofscripts=readushort(f)
  local scripts={}
  for i=1,nofscripts do
   scripts[readtag(f)]=scriptoffset+readushort(f)
  end
  local languagesystems=setmetatableindex("table")
  for script,offset in next,scripts do
   setposition(f,offset)
   local defaultoffset=readushort(f)
   local noflanguages=readushort(f)
   local languages={}
   if defaultoffset>0 then
    languages.dflt=languagesystems[offset+defaultoffset]
   end
   for i=1,noflanguages do
    local language=readtag(f)
    local offset=offset+readushort(f)
    languages[language]=languagesystems[offset]
   end
   scripts[script]=languages
  end
  for offset,usedfeatures in next,languagesystems do
   if offset>0 then
    setposition(f,offset)
    local featureindices={}
    usedfeatures.featureindices=featureindices
    usedfeatures.lookuporder=readushort(f) 
    usedfeatures.requiredindex=readushort(f) 
    local noffeatures=readushort(f)
    for i=1,noffeatures do
     featureindices[i]=readushort(f)+1
    end
   end
  end
  return scripts
 end
 local function readfeatures(f,fontdata,featureoffset)
  setposition(f,featureoffset)
  local features={}
  local noffeatures=readushort(f)
  for i=1,noffeatures do
   features[i]={
    tag=readtag(f),
    offset=readushort(f)
   }
  end
  for i=1,noffeatures do
   local feature=features[i]
   local offset=featureoffset+feature.offset
   setposition(f,offset)
   local parameters=readushort(f) 
   local noflookups=readushort(f)
   if noflookups>0 then
    local lookups=readcardinaltable(f,noflookups,ushort)
    feature.lookups=lookups
    for j=1,noflookups do
     lookups[j]=lookups[j]+1
    end
   end
   if parameters>0 then
    feature.parameters=parameters
    local plugin=plugins[feature.tag]
    if plugin then
     plugin(f,fontdata,featureoffset,feature)
    end
   end
  end
  return features
 end
 local function readlookups(f,lookupoffset,lookuptypes,featurehash,featureorder)
  setposition(f,lookupoffset)
  local noflookups=readushort(f)
  local lookups=readcardinaltable(f,noflookups,ushort)
  for lookupid=1,noflookups do
   local offset=lookups[lookupid]
   setposition(f,lookupoffset+offset)
   local subtables={}
   local typebits=readushort(f)
   local flagbits=readushort(f)
   local lookuptype=lookuptypes[typebits]
   local lookupflags=lookupflags[flagbits]
   local nofsubtables=readushort(f)
   for j=1,nofsubtables do
    subtables[j]=offset+readushort(f) 
   end
   local markclass=band(flagbits,0x0010)~=0 
   if markclass then
    markclass=readushort(f) 
   end
   local markset=rshift(flagbits,8)
   if markset>0 then
    markclass=markset 
   end
   lookups[lookupid]={
    type=lookuptype,
    flags=lookupflags,
    name=lookupid,
    subtables=subtables,
    markclass=markclass,
    features=featurehash[lookupid],
    order=featureorder[lookupid],
   }
  end
  return lookups
 end
 local f_lookupname=formatters["%s_%s_%s"]
 local function resolvelookups(f,lookupoffset,fontdata,lookups,lookuptypes,lookuphandlers,what,tableoffset)
  local sequences=fontdata.sequences  or {}
  local sublookuplist=fontdata.sublookups or {}
  fontdata.sequences=sequences
  fontdata.sublookups=sublookuplist
  local nofsublookups=#sublookuplist
  local nofsequences=#sequences 
  local lastsublookup=nofsublookups
  local lastsequence=nofsequences
  local lookupnames=lookupnames[what]
  local sublookuphash={}
  local sublookupcheck={}
  local glyphs=fontdata.glyphs
  local nofglyphs=fontdata.nofglyphs or #glyphs
  local noflookups=#lookups
  local lookupprefix=sub(what,2,2)
  local usedlookups=false
  for lookupid=1,noflookups do
   local lookup=lookups[lookupid]
   local lookuptype=lookup.type
   local subtables=lookup.subtables
   local features=lookup.features
   local handler=lookuphandlers[lookuptype]
   if handler then
    local nofsubtables=#subtables
    local order=lookup.order
    local flags=lookup.flags
    if flags[1] then flags[1]="mark" end
    if flags[2] then flags[2]="ligature" end
    if flags[3] then flags[3]="base" end
    local markclass=lookup.markclass
    if nofsubtables>0 then
     local steps={}
     local nofsteps=0
     local oldtype=nil
     for s=1,nofsubtables do
      local step,lt=handler(f,fontdata,lookupid,lookupoffset,subtables[s],glyphs,nofglyphs)
      if lt then
       lookuptype=lt
       if oldtype and lt~=oldtype then
        report("messy %s lookup type %a and %a",what,lookuptype,oldtype)
       end
       oldtype=lookuptype
      end
      if not step then
       report("unsupported %s lookup type %a",what,lookuptype)
      else
       nofsteps=nofsteps+1
       steps[nofsteps]=step
       local rules=step.rules
       if rules then
        for i=1,#rules do
         local rule=rules[i]
         local before=rule.before
         local current=rule.current
         local after=rule.after
         local replacements=rule.replacements
         if before then
          for i=1,#before do
           before[i]=tohash(before[i])
          end
          rule.before=reversed(before)
         end
         if current then
          if replacements then
           local first=current[1]
           local hash={}
           local repl={}
           for i=1,#first do
            local c=first[i]
            hash[c]=true
            repl[c]=replacements[i]
           end
           rule.current={ hash }
           rule.replacements=repl
          else
           for i=1,#current do
            current[i]=tohash(current[i])
           end
          end
         else
         end
         if after then
          for i=1,#after do
           after[i]=tohash(after[i])
          end
         end
         if usedlookups then
          local lookups=rule.lookups
          if lookups then
           for k,v in next,lookups do
            if v then
             for k,v in next,v do
              usedlookups[v]=usedlookups[v]+1
             end
            end
           end
          end
         end
        end
       end
      end
     end
     if nofsteps~=nofsubtables then
      report("bogus subtables removed in %s lookup type %a",what,lookuptype)
     end
     lookuptype=lookupnames[lookuptype] or lookuptype
     if features then
      nofsequences=nofsequences+1
      local l={
       index=nofsequences,
       name=f_lookupname(lookupprefix,"s",lookupid+lookupidoffset),
       steps=steps,
       nofsteps=nofsteps,
       type=lookuptype,
       markclass=markclass or nil,
       flags=flags,
       order=order,
       features=features,
      }
      sequences[nofsequences]=l
      lookup.done=l
     else
      nofsublookups=nofsublookups+1
      local l={
       index=nofsublookups,
       name=f_lookupname(lookupprefix,"l",lookupid+lookupidoffset),
       steps=steps,
       nofsteps=nofsteps,
       type=lookuptype,
       markclass=markclass or nil,
       flags=flags,
      }
      sublookuplist[nofsublookups]=l
      sublookuphash[lookupid]=nofsublookups
      sublookupcheck[lookupid]=0
      lookup.done=l
     end
    else
     report("no subtables for lookup %a",lookupid)
    end
   else
    report("no handler for lookup %a with type %a",lookupid,lookuptype)
   end
  end
  if usedlookups then
   report("used %s lookups: % t",what,sortedkeys(usedlookups))
  end
  local reported={}
  local function report_issue(i,what,sequence,kind)
   local name=sequence.name
   if not reported[name] then
    report("rule %i in %s lookup %a has %s lookups",i,what,name,kind)
    reported[name]=true
   end
  end
  for i=lastsequence+1,nofsequences do
   local sequence=sequences[i]
   local steps=sequence.steps
   for i=1,#steps do
    local step=steps[i]
    local rules=step.rules
    if rules then
     for i=1,#rules do
      local rule=rules[i]
      local rlookups=rule.lookups
      if not rlookups then
       report_issue(i,what,sequence,"no")
      elseif not next(rlookups) then
       rule.lookups=nil
      else
       local length=#rlookups
       for index=1,length do
        local lookuplist=rlookups[index]
        if lookuplist then
         local length=#lookuplist
         local found={}
         local noffound=0
         for index=1,length do
          local lookupid=lookuplist[index]
          if lookupid then
           local h=sublookuphash[lookupid]
           if not h then
            local lookup=lookups[lookupid]
            if lookup then
             local d=lookup.done
             if d then
              nofsublookups=nofsublookups+1
              local l={
               index=nofsublookups,
               name=f_lookupname(lookupprefix,"d",lookupid+lookupidoffset),
               derived=true,
               steps=d.steps,
               nofsteps=d.nofsteps,
               type=d.lookuptype or "gsub_single",
               markclass=d.markclass or nil,
               flags=d.flags,
              }
              sublookuplist[nofsublookups]=copy(l) 
              sublookuphash[lookupid]=nofsublookups
              sublookupcheck[lookupid]=1
              h=nofsublookups
             else
              report_issue(i,what,sequence,"missing")
              rule.lookups=nil
              break
             end
            else
             report_issue(i,what,sequence,"bad")
             rule.lookups=nil
             break
            end
           else
            sublookupcheck[lookupid]=sublookupcheck[lookupid]+1
           end
           if h then
            noffound=noffound+1
            found[noffound]=h
           end
          end
         end
         rlookups[index]=noffound>0 and found or false
        else
         rlookups[index]=false
        end
       end
      end
     end
    end
   end
  end
  for i,n in sortedhash(sublookupcheck) do
   local l=lookups[i]
   local t=l.type
   if n==0 and t~="extension" then
    local d=l.done
    report("%s lookup %s of type %a is not used",what,d and d.name or l.name,t)
   end
  end
 end
 local function loadvariations(f,fontdata,variationsoffset,lookuptypes,featurehash,featureorder)
  setposition(f,variationsoffset)
  local version=readulong(f) 
  local nofrecords=readulong(f)
  local records={}
  for i=1,nofrecords do
   records[i]={
    conditions=readulong(f),
    substitutions=readulong(f),
   }
  end
  for i=1,nofrecords do
   local record=records[i]
   local offset=record.conditions
   if offset==0 then
    record.condition=nil
    record.matchtype="always"
   else
    local offset=variationsoffset+offset
    setposition(f,offset)
    local nofconditions=readushort(f)
    local conditions={}
    for i=1,nofconditions do
     conditions[i]=offset+readulong(f)
    end
    record.conditions=conditions
    record.matchtype="condition"
   end
  end
  for i=1,nofrecords do
   local record=records[i]
   if record.matchtype=="condition" then
    local conditions=record.conditions
    for i=1,#conditions do
     setposition(f,conditions[i])
     conditions[i]={
      format=readushort(f),
      axis=readushort(f),
      minvalue=read2dot14(f),
      maxvalue=read2dot14(f),
     }
    end
   end
  end
  for i=1,nofrecords do
   local record=records[i]
   local offset=record.substitutions
   if offset==0 then
    record.substitutions={}
   else
    setposition(f,variationsoffset+offset)
    local version=readulong(f)
    local nofsubstitutions=readushort(f)
    local substitutions={}
    for i=1,nofsubstitutions do
     substitutions[readushort(f)]=readulong(f)
    end
    for index,alternates in sortedhash(substitutions) do
     if index==0 then
      record.substitutions=false
     else
      local tableoffset=variationsoffset+offset+alternates
      setposition(f,tableoffset)
      local parameters=readulong(f) 
      local noflookups=readushort(f)
      local lookups=readcardinaltable(f,noflookups,ushort)
      record.substitutions=lookups
     end
    end
   end
  end
  setvariabledata(fontdata,"features",records)
 end
 local function readscripts(f,fontdata,what,lookuptypes,lookuphandlers,lookupstoo)
  local tableoffset=gotodatatable(f,fontdata,what,true)
  if tableoffset then
   local version=readulong(f)
   local scriptoffset=tableoffset+readushort(f)
   local featureoffset=tableoffset+readushort(f)
   local lookupoffset=tableoffset+readushort(f)
   local variationsoffset=version>0x00010000 and (tableoffset+readulong(f)) or 0
   if not scriptoffset then
    return
   end
   local scripts=readscriplan(f,fontdata,scriptoffset)
   local features=readfeatures(f,fontdata,featureoffset)
   local scriptlangs,featurehash,featureorder=reorderfeatures(fontdata,scripts,features)
   if fontdata.features then
    fontdata.features[what]=scriptlangs
   else
    fontdata.features={ [what]=scriptlangs }
   end
   if not lookupstoo then
    return
   end
   local lookups=readlookups(f,lookupoffset,lookuptypes,featurehash,featureorder)
   if lookups then
    resolvelookups(f,lookupoffset,fontdata,lookups,lookuptypes,lookuphandlers,what,tableoffset)
   end
   if variationsoffset>0 then
    loadvariations(f,fontdata,variationsoffset,lookuptypes,featurehash,featureorder)
   end
  end
 end
 local function checkkerns(f,fontdata,specification)
  local datatable=fontdata.tables.kern
  if not datatable then
   return 
  end
  local features=fontdata.features
  local gposfeatures=features and features.gpos
  local name
  if not gposfeatures or not gposfeatures.kern then
   name="kern"
  elseif specification.globalkerns then
   name="globalkern"
  else
   report("ignoring global kern table, using gpos kern feature")
   return
  end
  setposition(f,datatable.offset)
  local version=readushort(f)
  local noftables=readushort(f)
  if noftables>1 then
   report("adding global kern table as gpos feature %a",name)
   local kerns=setmetatableindex("table")
   for i=1,noftables do
    local version=readushort(f)
    local length=readushort(f)
    local coverage=readushort(f)
    local format=rshift(coverage,8) 
    if format==0 then
     local nofpairs=readushort(f)
     local searchrange=readushort(f)
     local entryselector=readushort(f)
     local rangeshift=readushort(f)
     for i=1,nofpairs do
      kerns[readushort(f)][readushort(f)]=readfword(f)
     end
    elseif format==2 then
    else
    end
   end
   local feature={ dflt={ dflt=true } }
   if not features then
    fontdata.features={ gpos={ [name]=feature } }
   elseif not gposfeatures then
    fontdata.features.gpos={ [name]=feature }
   else
    gposfeatures[name]=feature
   end
   local sequences=fontdata.sequences
   if not sequences then
    sequences={}
    fontdata.sequences=sequences
   end
   local nofsequences=#sequences+1
   sequences[nofsequences]={
    index=nofsequences,
    name=name,
    steps={
     {
      coverage=kerns,
      format="kern",
     },
    },
    nofsteps=1,
    type="gpos_pair",
    flags={ false,false,false,false },
    order={ name },
    features={ [name]=feature },
   }
  else
   report("ignoring empty kern table of feature %a",name)
  end
 end
 function readers.gsub(f,fontdata,specification)
  if specification.details then
   readscripts(f,fontdata,"gsub",gsubtypes,gsubhandlers,specification.lookups)
  end
 end
 function readers.gpos(f,fontdata,specification)
  if specification.details then
   readscripts(f,fontdata,"gpos",gpostypes,gposhandlers,specification.lookups)
   if specification.lookups then
    checkkerns(f,fontdata,specification)
   end
  end
 end
end
function readers.gdef(f,fontdata,specification)
 if not specification.glyphs then
  return
 end
 local datatable=fontdata.tables.gdef
 if datatable then
  local tableoffset=datatable.offset
  setposition(f,tableoffset)
  local version=readulong(f)
  local classoffset=readushort(f)
  local attachmentoffset=readushort(f) 
  local ligaturecarets=readushort(f) 
  local markclassoffset=readushort(f)
  local marksetsoffset=version>=0x00010002 and readushort(f) or 0
  local varsetsoffset=version>=0x00010003 and readulong(f) or 0
  local glyphs=fontdata.glyphs
  local marks={}
  local markclasses=setmetatableindex("table")
  local marksets=setmetatableindex("table")
  fontdata.marks=marks
  fontdata.markclasses=markclasses
  fontdata.marksets=marksets
  if classoffset~=0 then
   setposition(f,tableoffset+classoffset)
   local classformat=readushort(f)
   if classformat==1 then
    local firstindex=readushort(f)
    local lastindex=firstindex+readushort(f)-1
    for index=firstindex,lastindex do
     local class=classes[readushort(f)]
     if class=="mark" then
      marks[index]=true
     end
     glyphs[index].class=class
    end
   elseif classformat==2 then
    local nofranges=readushort(f)
    for i=1,nofranges do
     local firstindex=readushort(f)
     local lastindex=readushort(f)
     local class=classes[readushort(f)]
     if class then
      for index=firstindex,lastindex do
       glyphs[index].class=class
       if class=="mark" then
        marks[index]=true
       end
      end
     end
    end
   end
  end
  if markclassoffset~=0 then
   setposition(f,tableoffset+markclassoffset)
   local classformat=readushort(f)
   if classformat==1 then
    local firstindex=readushort(f)
    local lastindex=firstindex+readushort(f)-1
    for index=firstindex,lastindex do
     markclasses[readushort(f)][index]=true
    end
   elseif classformat==2 then
    local nofranges=readushort(f)
    for i=1,nofranges do
     local firstindex=readushort(f)
     local lastindex=readushort(f)
     local class=markclasses[readushort(f)]
     for index=firstindex,lastindex do
      class[index]=true
     end
    end
   end
  end
  if marksetsoffset~=0 then
   marksetsoffset=tableoffset+marksetsoffset
   setposition(f,marksetsoffset)
   local format=readushort(f)
   if format==1 then
    local nofsets=readushort(f)
    local sets=readcardinaltable(f,nofsets,ulong)
    for i=1,nofsets do
     local offset=sets[i]
     if offset~=0 then
      marksets[i]=readcoverage(f,marksetsoffset+offset)
     end
    end
   end
  end
  local factors=specification.factors
  if (specification.variable or factors) and varsetsoffset~=0 then
   local regions,deltas=readvariationdata(f,tableoffset+varsetsoffset,factors)
   if factors then
    fontdata.temporary.getdelta=function(outer,inner)
     local delta=deltas[outer+1]
     if delta then
      local d=delta.deltas[inner+1]
      if d then
       local scales=delta.scales
       local dd=0
       for i=1,#scales do
        local di=d[i]
        if di then
         dd=dd+scales[i]*di
        else
         break
        end
       end
       return round(dd)
      end
     end
     return 0
    end
   end
  end
 end
end
local function readmathvalue(f)
 local v=readshort(f)
 skipshort(f,1) 
 return v
end
local function readmathconstants(f,fontdata,offset)
 setposition(f,offset)
 fontdata.mathconstants={
  ScriptPercentScaleDown=readshort(f),
  ScriptScriptPercentScaleDown=readshort(f),
  DelimitedSubFormulaMinHeight=readushort(f),
  DisplayOperatorMinHeight=readushort(f),
  MathLeading=readmathvalue(f),
  AxisHeight=readmathvalue(f),
  AccentBaseHeight=readmathvalue(f),
  FlattenedAccentBaseHeight=readmathvalue(f),
  SubscriptShiftDown=readmathvalue(f),
  SubscriptTopMax=readmathvalue(f),
  SubscriptBaselineDropMin=readmathvalue(f),
  SuperscriptShiftUp=readmathvalue(f),
  SuperscriptShiftUpCramped=readmathvalue(f),
  SuperscriptBottomMin=readmathvalue(f),
  SuperscriptBaselineDropMax=readmathvalue(f),
  SubSuperscriptGapMin=readmathvalue(f),
  SuperscriptBottomMaxWithSubscript=readmathvalue(f),
  SpaceAfterScript=readmathvalue(f),
  UpperLimitGapMin=readmathvalue(f),
  UpperLimitBaselineRiseMin=readmathvalue(f),
  LowerLimitGapMin=readmathvalue(f),
  LowerLimitBaselineDropMin=readmathvalue(f),
  StackTopShiftUp=readmathvalue(f),
  StackTopDisplayStyleShiftUp=readmathvalue(f),
  StackBottomShiftDown=readmathvalue(f),
  StackBottomDisplayStyleShiftDown=readmathvalue(f),
  StackGapMin=readmathvalue(f),
  StackDisplayStyleGapMin=readmathvalue(f),
  StretchStackTopShiftUp=readmathvalue(f),
  StretchStackBottomShiftDown=readmathvalue(f),
  StretchStackGapAboveMin=readmathvalue(f),
  StretchStackGapBelowMin=readmathvalue(f),
  FractionNumeratorShiftUp=readmathvalue(f),
  FractionNumeratorDisplayStyleShiftUp=readmathvalue(f),
  FractionDenominatorShiftDown=readmathvalue(f),
  FractionDenominatorDisplayStyleShiftDown=readmathvalue(f),
  FractionNumeratorGapMin=readmathvalue(f),
  FractionNumeratorDisplayStyleGapMin=readmathvalue(f),
  FractionRuleThickness=readmathvalue(f),
  FractionDenominatorGapMin=readmathvalue(f),
  FractionDenominatorDisplayStyleGapMin=readmathvalue(f),
  SkewedFractionHorizontalGap=readmathvalue(f),
  SkewedFractionVerticalGap=readmathvalue(f),
  OverbarVerticalGap=readmathvalue(f),
  OverbarRuleThickness=readmathvalue(f),
  OverbarExtraAscender=readmathvalue(f),
  UnderbarVerticalGap=readmathvalue(f),
  UnderbarRuleThickness=readmathvalue(f),
  UnderbarExtraDescender=readmathvalue(f),
  RadicalVerticalGap=readmathvalue(f),
  RadicalDisplayStyleVerticalGap=readmathvalue(f),
  RadicalRuleThickness=readmathvalue(f),
  RadicalExtraAscender=readmathvalue(f),
  RadicalKernBeforeDegree=readmathvalue(f),
  RadicalKernAfterDegree=readmathvalue(f),
  RadicalDegreeBottomRaisePercent=readshort(f),
 }
end
local function readmathglyphinfo(f,fontdata,offset)
 setposition(f,offset)
 local italics=readushort(f)
 local accents=readushort(f)
 local extensions=readushort(f)
 local kerns=readushort(f)
 local glyphs=fontdata.glyphs
 if italics~=0 then
  setposition(f,offset+italics)
  local coverage=readushort(f)
  local nofglyphs=readushort(f)
  coverage=readcoverage(f,offset+italics+coverage,true)
  setposition(f,offset+italics+4)
  for i=1,nofglyphs do
   local italic=readmathvalue(f)
   if italic~=0 then
    local glyph=glyphs[coverage[i]]
    local math=glyph.math
    if not math then
     glyph.math={ italic=italic }
    else
     math.italic=italic
    end
   end
  end
  fontdata.hasitalics=true
 end
 if accents~=0 then
  setposition(f,offset+accents)
  local coverage=readushort(f)
  local nofglyphs=readushort(f)
  coverage=readcoverage(f,offset+accents+coverage,true)
  setposition(f,offset+accents+4)
  for i=1,nofglyphs do
   local accent=readmathvalue(f)
   if accent~=0 then
    local glyph=glyphs[coverage[i]]
    local math=glyph.math
    if not math then
     glyph.math={ accent=accent }
    else
     math.accent=accent
    end
   end
  end
 end
 if extensions~=0 then
  setposition(f,offset+extensions)
 end
 if kerns~=0 then
  local kernoffset=offset+kerns
  setposition(f,kernoffset)
  local coverage=readushort(f)
  local nofglyphs=readushort(f)
  if nofglyphs>0 then
   local function get(offset)
    setposition(f,kernoffset+offset)
    local n=readushort(f)
    if n==0 then
     local k=readmathvalue(f)
     if k==0 then
     else
      return { { kern=k } }
     end
    else
     local l={}
     for i=1,n do
      l[i]={ height=readmathvalue(f) }
     end
     for i=1,n do
      l[i].kern=readmathvalue(f)
     end
     l[n+1]={ kern=readmathvalue(f) }
     return l
    end
   end
   local kernsets={}
   for i=1,nofglyphs do
    local topright=readushort(f)
    local topleft=readushort(f)
    local bottomright=readushort(f)
    local bottomleft=readushort(f)
    kernsets[i]={
     topright=topright~=0 and topright or nil,
     topleft=topleft~=0 and topleft  or nil,
     bottomright=bottomright~=0 and bottomright or nil,
     bottomleft=bottomleft~=0 and bottomleft  or nil,
    }
   end
   coverage=readcoverage(f,kernoffset+coverage,true)
   for i=1,nofglyphs do
    local kernset=kernsets[i]
    if next(kernset) then
     local k=kernset.topright if k then kernset.topright=get(k) end
     local k=kernset.topleft  if k then kernset.topleft=get(k) end
     local k=kernset.bottomright if k then kernset.bottomright=get(k) end
     local k=kernset.bottomleft  if k then kernset.bottomleft=get(k) end
     if next(kernset) then
      local glyph=glyphs[coverage[i]]
      local math=glyph.math
      if math then
       math.kerns=kernset
      else
       glyph.math={ kerns=kernset }
      end
     end
    end
   end
  end
 end
end
local function readmathvariants(f,fontdata,offset)
 setposition(f,offset)
 local glyphs=fontdata.glyphs
 local minoverlap=readushort(f)
 local vcoverage=readushort(f)
 local hcoverage=readushort(f)
 local vnofglyphs=readushort(f)
 local hnofglyphs=readushort(f)
 local vconstruction=readcardinaltable(f,vnofglyphs,ushort)
 local hconstruction=readcardinaltable(f,hnofglyphs,ushort)
 fontdata.mathconstants.MinConnectorOverlap=minoverlap
 local function get(offset,coverage,nofglyphs,construction,kvariants,kparts,kitalic)
  if coverage~=0 and nofglyphs>0 then
   local coverage=readcoverage(f,offset+coverage,true)
   for i=1,nofglyphs do
    local c=construction[i]
    if c~=0 then
     local index=coverage[i]
     local glyph=glyphs[index]
     local math=glyph.math
     setposition(f,offset+c)
     local assembly=readushort(f)
     local nofvariants=readushort(f)
     if nofvariants>0 then
      local variants,v=nil,0
      for i=1,nofvariants do
       local variant=readushort(f)
       if variant==index then
       elseif variants then
        v=v+1
        variants[v]=variant
       else
        v=1
        variants={ variant }
       end
       skipshort(f)
      end
      if not variants then
      elseif not math then
       math={ [kvariants]=variants }
       glyph.math=math
      else
       math[kvariants]=variants
      end
     end
     if assembly~=0 then
      setposition(f,offset+c+assembly)
      local italic=readmathvalue(f)
      local nofparts=readushort(f)
      local parts={}
      for i=1,nofparts do
       local p={
        glyph=readushort(f),
        start=readushort(f),
        ["end"]=readushort(f),
        advance=readushort(f),
       }
       local flags=readushort(f)
       if band(flags,0x0001)~=0 then
        p.extender=1 
       end
       parts[i]=p
      end
      if not math then
       math={
        [kparts]=parts
       }
       glyph.math=math
      else
       math[kparts]=parts
      end
      if italic and italic~=0 then
       math[kitalic]=italic
      end
     end
    end
   end
  end
 end
 get(offset,vcoverage,vnofglyphs,vconstruction,"vvariants","vparts","vitalic")
 get(offset,hcoverage,hnofglyphs,hconstruction,"hvariants","hparts","hitalic")
end
function readers.math(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"math",specification.glyphs)
 if tableoffset then
  local version=readulong(f)
  local constants=readushort(f)
  local glyphinfo=readushort(f)
  local variants=readushort(f)
  if constants==0 then
   report("the math table of %a has no constants",fontdata.filename)
  else
   readmathconstants(f,fontdata,tableoffset+constants)
  end
  if glyphinfo~=0 then
   readmathglyphinfo(f,fontdata,tableoffset+glyphinfo)
  end
  if variants~=0 then
   readmathvariants(f,fontdata,tableoffset+variants)
  end
 end
end
function readers.colr(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"colr",specification.glyphs)
 if tableoffset then
  local version=readushort(f)
  if version~=0 then
   report("table version %a of %a is not supported (yet), maybe font %s is bad",version,"colr",fontdata.filename)
   return
  end
  if not fontdata.tables.cpal then
   report("color table %a in font %a has no mandate %a table","colr",fontdata.filename,"cpal")
   fontdata.colorpalettes={}
  end
  local glyphs=fontdata.glyphs
  local nofglyphs=readushort(f)
  local baseoffset=readulong(f)
  local layeroffset=readulong(f)
  local noflayers=readushort(f)
  local layerrecords={}
  local maxclass=0
  setposition(f,tableoffset+layeroffset)
  for i=1,noflayers do
   local slot=readushort(f)
   local class=readushort(f)
   if class<0xFFFF then
    class=class+1
    if class>maxclass then
     maxclass=class
    end
   end
   layerrecords[i]={
    slot=slot,
    class=class,
   }
  end
  fontdata.maxcolorclass=maxclass
  setposition(f,tableoffset+baseoffset)
  for i=0,nofglyphs-1 do
   local glyphindex=readushort(f)
   local firstlayer=readushort(f)
   local noflayers=readushort(f)
   local t={}
   for i=1,noflayers do
    t[i]=layerrecords[firstlayer+i]
   end
   glyphs[glyphindex].colors=t
  end
 end
 fontdata.hascolor=true
end
function readers.cpal(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"cpal",specification.glyphs)
 if tableoffset then
  local version=readushort(f)
  local nofpaletteentries=readushort(f)
  local nofpalettes=readushort(f)
  local nofcolorrecords=readushort(f)
  local firstcoloroffset=readulong(f)
  local colorrecords={}
  local palettes=readcardinaltable(f,nofpalettes,ushort)
  if version==1 then
   local palettettypesoffset=readulong(f)
   local palettelabelsoffset=readulong(f)
   local paletteentryoffset=readulong(f)
  end
  setposition(f,tableoffset+firstcoloroffset)
  for i=1,nofcolorrecords do
   local b,g,r,a=readbytes(f,4)
   colorrecords[i]={
    r,g,b,a~=255 and a or nil,
   }
  end
  for i=1,nofpalettes do
   local p={}
   local o=palettes[i]
   for j=1,nofpaletteentries do
    p[j]=colorrecords[o+j]
   end
   palettes[i]=p
  end
  fontdata.colorpalettes=palettes
 end
end
local compress=gzip and gzip.compress
local compressed=compress and gzip.compressed
function readers.svg(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"svg",specification.glyphs)
 if tableoffset then
  local version=readushort(f)
  local glyphs=fontdata.glyphs
  local indexoffset=tableoffset+readulong(f)
  local reserved=readulong(f)
  setposition(f,indexoffset)
  local nofentries=readushort(f)
  local entries={}
  for i=1,nofentries do
   entries[i]={
    first=readushort(f),
    last=readushort(f),
    offset=indexoffset+readulong(f),
    length=readulong(f),
   }
  end
  for i=1,nofentries do
   local entry=entries[i]
   setposition(f,entry.offset)
   local data=readstring(f,entry.length)
   if compressed and not compressed(data) then
    data=compress(data)
   end
   entries[i]={
    first=entry.first,
    last=entry.last,
    data=data
   }
  end
  fontdata.svgshapes=entries
 end
 fontdata.hascolor=true
end
function readers.sbix(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"sbix",specification.glyphs)
 if tableoffset then
  local version=readushort(f)
  local flags=readushort(f)
  local nofstrikes=readulong(f)
  local strikes={}
  local nofglyphs=fontdata.nofglyphs
  for i=1,nofstrikes do
   strikes[i]=readulong(f)
  end
  local shapes={}
  local done=0
  for i=1,nofstrikes do
   local strikeoffset=strikes[i]+tableoffset
   setposition(f,strikeoffset)
   strikes[i]={
    ppem=readushort(f),
    ppi=readushort(f),
    offset=strikeoffset
   }
  end
  sort(strikes,function(a,b)
   if b.ppem==a.ppem then
    return b.ppi<a.ppi
   else
    return b.ppem<a.ppem
   end
  end)
  local glyphs={}
  local delayed=CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 or fonts.handlers.typethree
  for i=1,nofstrikes do
   local strike=strikes[i]
   local strikeppem=strike.ppem
   local strikeppi=strike.ppi
   local strikeoffset=strike.offset
   setposition(f,strikeoffset)
   for i=0,nofglyphs do
    glyphs[i]=readulong(f)
   end
   local glyphoffset=glyphs[0]
   for i=0,nofglyphs-1 do
    local nextoffset=glyphs[i+1]
    if not shapes[i] then
     local datasize=nextoffset-glyphoffset
     if datasize>0 then
      setposition(f,strikeoffset+glyphoffset)
      local x=readshort(f)
      local y=readshort(f)
      local tag=readtag(f) 
      local size=datasize-8
      local data=nil
      local offset=nil
      if delayed then
       offset=getposition(f)
       data=nil
      else
       data=readstring(f,size)
       size=nil
      end
      shapes[i]={
       x=x,
       y=y,
       o=offset,
       s=size,
       data=data,
      }
      done=done+1
      if done==nofglyphs then
       break
      end
     end
    end
    glyphoffset=nextoffset
   end
  end
  fontdata.pngshapes=shapes
 end
end
do
 local function getmetrics(f)
  return {
   ascender=readinteger(f),
   descender=readinteger(f),
   widthmax=readuinteger(f),
   caretslopedumerator=readinteger(f),
   caretslopedenominator=readinteger(f),
   caretoffset=readinteger(f),
   minorigin=readinteger(f),
   minadvance=readinteger(f),
   maxbefore=readinteger(f),
   minafter=readinteger(f),
   pad1=readinteger(f),
   pad2=readinteger(f),
  }
 end
 local function getbigmetrics(f)
  return {
   height=readuinteger(f),
   width=readuinteger(f),
   horiBearingX=readinteger(f),
   horiBearingY=readinteger(f),
   horiAdvance=readuinteger(f),
   vertBearingX=readinteger(f),
   vertBearingY=readinteger(f),
   vertAdvance=readuinteger(f),
  }
 end
 local function getsmallmetrics(f)
  return {
   height=readuinteger(f),
   width=readuinteger(f),
   bearingX=readinteger(f),
   bearingY=readinteger(f),
   advance=readuinteger(f),
  }
 end
 function readers.cblc(f,fontdata,specification)
  local ctdttableoffset=gotodatatable(f,fontdata,"cbdt",specification.glyphs)
  if not ctdttableoffset then
   return
  end
  local cblctableoffset=gotodatatable(f,fontdata,"cblc",specification.glyphs)
  if cblctableoffset then
   local majorversion=readushort(f)
   local minorversion=readushort(f)
   local nofsizetables=readulong(f)
   local sizetables={}
   local shapes={}
   local subtables={}
   for i=1,nofsizetables do
    sizetables[i]={
     subtables=readulong(f),
     indexsize=readulong(f),
     nofsubtables=readulong(f),
     colorref=readulong(f),
     hormetrics=getmetrics(f),
     vermetrics=getmetrics(f),
     firstindex=readushort(f),
     lastindex=readushort(f),
     ppemx=readbyte(f),
     ppemy=readbyte(f),
     bitdepth=readbyte(f),
     flags=readbyte(f),
    }
   end
   sort(sizetables,function(a,b)
    if b.ppemx==a.ppemx then
     return b.bitdepth<a.bitdepth
    else
     return b.ppemx<a.ppemx
    end
   end)
   for i=1,nofsizetables do
    local s=sizetables[i]
    local d=false
    for j=s.firstindex,s.lastindex do
     if not shapes[j] then
      shapes[j]=i
      d=true
     end
    end
    if d then
     s.used=true
    end
   end
   for i=1,nofsizetables do
    local s=sizetables[i]
    if s.used then
     local offset=s.subtables
     setposition(f,cblctableoffset+offset)
     for j=1,s.nofsubtables do
      local firstindex=readushort(f)
      local lastindex=readushort(f)
      local tableoffset=readulong(f)+offset
      for k=firstindex,lastindex do
       if shapes[k]==i then
        local s=subtables[tableoffset]
        if not s then
         s={
          firstindex=firstindex,
          lastindex=lastindex,
         }
         subtables[tableoffset]=s
        end
        shapes[k]=s
       end
      end
     end
    end
   end
   for offset,subtable in sortedhash(subtables) do
    local tabletype=readushort(f)
    subtable.format=readushort(f)
    local baseoffset=readulong(f)+ctdttableoffset
    local offsets={}
    local metrics=nil
    if tabletype==1 then
     for i=subtable.firstindex,subtable.lastindex do
      offsets[i]=readulong(f)+baseoffset
     end
     skipbytes(f,4)
    elseif tabletype==2 then
     local size=readulong(f)
     local done=baseoffset
     metrics=getbigmetrics(f)
     for i=subtable.firstindex,subtable.lastindex do
      offsets[i]=done
      done=done+size
     end
    elseif tabletype==3 then
     local n=subtable.lastindex-subtable.firstindex+2
     for i=subtable.firstindex,subtable.lastindex do
      offsets[i]=readushort(f)+baseoffset
     end
     if math.odd(n) then
      skipbytes(f,4)
     else
      skipbytes(f,2)
     end
    elseif tabletype==4 then
     for i=1,readulong(f) do
      offsets[readushort(f)]=readushort(f)+baseoffset
     end
    elseif tabletype==5 then
     local size=readulong(f)
     local done=baseoffset
     metrics=getbigmetrics(f)
     local n=readulong(f)
     for i=1,n do
      offsets[readushort(f)]=done
      done=done+size
     end
     if math.odd(n) then
      skipbytes(f,2)
     end
    else
     return 
    end
    subtable.offsets=offsets
    subtable.metrics=metrics
   end
   local default={ width=0,height=0 }
   local glyphs=fontdata.glyphs
   local delayed=CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 or fonts.handlers.typethree
   for index,subtable in sortedhash(shapes) do
    if type(subtable)=="table" then
     local data=nil
     local size=nil
     local metrics=default
     local format=subtable.format
     local offset=subtable.offsets[index]
     setposition(f,offset)
     if format==17 then
      metrics=getsmallmetrics(f)
      size=true
     elseif format==18 then
      metrics=getbigmetrics(f)
      size=true
     elseif format==19 then
      metrics=subtable.metrics
      size=true
     else
     end
     if size then
      size=readulong(f)
      if delayed then
       offset=getposition(f)
       data=nil
      else
       offset=nil
       data=readstring(f,size)
       size=nil
      end
     else
      offset=nil
     end
     local x=metrics.width
     local y=metrics.height
     shapes[index]={
      x=x,
      y=y,
      o=offset,
      s=size,
      data=data,
     }
     local glyph=glyphs[index]
     if not glyph.boundingbox then
      local width=glyph.width
      local height=width*y/x
      glyph.boundingbox={ 0,0,width,height }
     end
    else
     shapes[index]={
      x=0,
      y=0,
      data="",
     }
    end
   end
   fontdata.pngshapes=shapes 
  end
 end
 function readers.cbdt(f,fontdata,specification)
 end
end
function readers.stat(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"stat",true) 
 if tableoffset then
  local extras=fontdata.extras
  local version=readulong(f) 
  local axissize=readushort(f)
  local nofaxis=readushort(f)
  local axisoffset=readulong(f)
  local nofvalues=readushort(f)
  local valuesoffset=readulong(f)
  local fallbackname=extras[readushort(f)] 
  local axis={}
  local values={}
  setposition(f,tableoffset+axisoffset)
  for i=1,nofaxis do
   local tag=readtag(f)
   axis[i]={
    tag=tag,
    name=lower(extras[readushort(f)] or tag),
    ordering=readushort(f),
    variants={}
   }
  end
  setposition(f,tableoffset+valuesoffset)
  for i=1,nofvalues do
   values[i]=readushort(f)
  end
  for i=1,nofvalues do
   setposition(f,tableoffset+valuesoffset+values[i])
   local format=readushort(f)
   local index=readushort(f)+1
   local flags=readushort(f)
   local name=lower(extras[readushort(f)] or "no name")
   local value=readfixed(f)
   local variant
   if format==1 then
    variant={
     flags=flags,
     name=name,
     value=value,
    }
   elseif format==2 then
    variant={
     flags=flags,
     name=name,
     value=value,
     minimum=readfixed(f),
     maximum=readfixed(f),
    }
   elseif format==3 then
    variant={
     flags=flags,
     name=name,
     value=value,
     link=readfixed(f),
    }
   end
   insert(axis[index].variants,variant)
  end
  sort(axis,function(a,b)
   return a.ordering<b.ordering
  end)
  for i=1,#axis do
   local a=axis[i]
   sort(a.variants,function(a,b)
    return a.name<b.name
   end)
   a.ordering=nil
  end
  setvariabledata(fontdata,"designaxis",axis)
  setvariabledata(fontdata,"fallbackname",fallbackname)
 end
end
function readers.avar(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"avar",true) 
 if tableoffset then
  local function collect()
   local nofvalues=readushort(f)
   local values={}
   local lastfrom=false
   local lastto=false
   for i=1,nofvalues do
    local from=read2dot14(f)
    local to=read2dot14(f)
    if lastfrom and from<=lastfrom then
    elseif lastto and to>=lastto then
    else
     values[#values+1]={ from,to }
     lastfrom,lastto=from,to
    end
   end
   nofvalues=#values
   if nofvalues>2 then
    local some=values[1]
    if some[1]==-1 and some[2]==-1 then
     some=values[nofvalues]
     if some[1]==1 and some[2]==1 then
      for i=2,nofvalues-1 do
       some=values[i]
       if some[1]==0 and some[2]==0 then
        return values
       end
      end
     end
    end
   end
   return false
  end
  local version=readulong(f) 
  local reserved=readushort(f)
  local nofaxis=readushort(f)
  local segments={}
  for i=1,nofaxis do
   segments[i]=collect()
  end
  setvariabledata(fontdata,"segments",segments)
 end
end
function readers.fvar(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"fvar",true) 
 if tableoffset then
  local version=readulong(f) 
  local offsettoaxis=tableoffset+readushort(f)
  local reserved=skipshort(f)
  local nofaxis=readushort(f)
  local sizeofaxis=readushort(f)
  local nofinstances=readushort(f)
  local sizeofinstances=readushort(f)
  local extras=fontdata.extras
  local axis={}
  local instances={}
  setposition(f,offsettoaxis)
  for i=1,nofaxis do
   axis[i]={
    tag=readtag(f),
    minimum=readfixed(f),
    default=readfixed(f),
    maximum=readfixed(f),
    flags=readushort(f),
    name=lower(extras[readushort(f)] or "bad name"),
   }
   local n=sizeofaxis-20
   if n>0 then
    skipbytes(f,n)
   elseif n<0 then
   end
  end
  local nofbytes=2+2+2+nofaxis*4
  local readpsname=nofbytes<=sizeofinstances
  local skippable=sizeofinstances-nofbytes
  for i=1,nofinstances do
   local subfamid=readushort(f)
   local flags=readushort(f) 
   local values={}
   for i=1,nofaxis do
    values[i]={
     axis=axis[i].tag,
     value=readfixed(f),
    }
   end
   local psnameid=readpsname and readushort(f) or 0xFFFF
   if subfamid==2 or subfamid==17 then
   elseif subfamid==0xFFFF then
    subfamid=nil
   elseif subfamid<=256 or subfamid>=32768 then
    subfamid=nil 
   end
   if psnameid==6 then
   elseif psnameid==0xFFFF then
    psnameid=nil
   elseif psnameid<=256 or psnameid>=32768 then
    psnameid=nil 
   end
   instances[i]={
    subfamily=extras[subfamid],
    psname=psnameid and extras[psnameid] or nil,
    values=values,
   }
   if skippable>0 then
    skipbytes(f,skippable)
   end
  end
  setvariabledata(fontdata,"axis",axis)
  setvariabledata(fontdata,"instances",instances)
 end
end
function readers.hvar(f,fontdata,specification)
 local factors=specification.factors
 if not factors then
  return
 end
 local tableoffset=gotodatatable(f,fontdata,"hvar",specification.variable)
 if not tableoffset then
  report("no hvar table, expect problems due to messy widths")
  return
 end
 local version=readulong(f) 
 local variationoffset=tableoffset+readulong(f) 
 local advanceoffset=tableoffset+readulong(f)
 local lsboffset=tableoffset+readulong(f)
 local rsboffset=tableoffset+readulong(f)
 local regions={}
 local variations={}
 local innerindex={} 
 local outerindex={} 
 if variationoffset>0 then
  regions,deltas=readvariationdata(f,variationoffset,factors)
 end
 if not regions then
  return
 end
 if advanceoffset>0 then
  setposition(f,advanceoffset)
  local format=readushort(f) 
  local mapcount=readushort(f)
  local entrysize=rshift(band(format,0x0030),4)+1
  local nofinnerbits=band(format,0x000F)+1 
  local innermask=lshift(1,nofinnerbits)-1
  local readcardinal=read_cardinal[entrysize] 
  for i=0,mapcount-1 do
   local mapdata=readcardinal(f)
   outerindex[i]=rshift(mapdata,nofinnerbits)
   innerindex[i]=band(mapdata,innermask)
  end
  setvariabledata(fontdata,"hvarwidths",true)
  local glyphs=fontdata.glyphs
  for i=0,fontdata.nofglyphs-1 do
   local glyph=glyphs[i]
   local width=glyph.width
   if width then
    local outer=outerindex[i] or 0
    local inner=innerindex[i] or i
    if outer and inner then 
     local delta=deltas[outer+1]
     if delta then
      local d=delta.deltas[inner+1]
      if d then
       local scales=delta.scales
       local deltaw=0
       for i=1,#scales do
        local di=d[i]
        if di then
         deltaw=deltaw+scales[i]*di
        else
         break 
        end
       end
       glyph.width=width+round(deltaw)
      end
     end
    end
   end
  end
 end
end
function readers.vvar(f,fontdata,specification)
 if not specification.variable then
  return
 end
end
function readers.mvar(f,fontdata,specification)
 local tableoffset=gotodatatable(f,fontdata,"mvar",specification.variable)
 if tableoffset then
  local version=readulong(f) 
  local reserved=skipshort(f,1)
  local recordsize=readushort(f)
  local nofrecords=readushort(f)
  local offsettostore=tableoffset+readushort(f)
  local dimensions={}
  local factors=specification.factors
  if factors then
   local regions,deltas=readvariationdata(f,offsettostore,factors)
   for i=1,nofrecords do
    local tag=readtag(f)
    local var=variabletags[tag]
    if var then
     local outer=readushort(f)
     local inner=readushort(f)
     local delta=deltas[outer+1]
     if delta then
      local d=delta.deltas[inner+1]
      if d then
       local scales=delta.scales
       local dd=0
       for i=1,#scales do
        dd=dd+scales[i]*d[i]
       end
       var(fontdata,round(dd))
      end
     end
    else
     skipshort(f,2)
    end
    if recordsize>8 then 
     skipbytes(recordsize-8)
    end
   end
  end
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-dsp”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oup” e6e2cc0a202aec2c787d5524e64d340a] ---

if not modules then modules={} end modules ['font-oup']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type=next,type
local P,R,S=lpeg.P,lpeg.R,lpeg.S
local lpegmatch=lpeg.match
local insert,remove,copy,unpack=table.insert,table.remove,table.copy,table.unpack
local formatters=string.formatters
local sortedkeys=table.sortedkeys
local sortedhash=table.sortedhash
local tohash=table.tohash
local setmetatableindex=table.setmetatableindex
local report_error=logs.reporter("otf reader","error")
local report_markwidth=logs.reporter("otf reader","markwidth")
local report_cleanup=logs.reporter("otf reader","cleanup")
local report_optimizations=logs.reporter("otf reader","merges")
local report_unicodes=logs.reporter("otf reader","unicodes")
local trace_markwidth=false  trackers.register("otf.markwidth",function(v) trace_markwidth=v end)
local trace_cleanup=false  trackers.register("otf.cleanups",function(v) trace_cleanups=v end)
local trace_optimizations=false  trackers.register("otf.optimizations",function(v) trace_optimizations=v end)
local trace_unicodes=false  trackers.register("otf.unicodes",function(v) trace_unicodes=v end)
local readers=fonts.handlers.otf.readers
local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000 
local f_private=formatters["P%05X"]
local f_unicode=formatters["U%05X"]
local f_index=formatters["I%05X"]
local f_character_y=formatters["%C"]
local f_character_n=formatters["[ %C ]"]
local check_duplicates=true 
local check_soft_hyphen=context 
directives.register("otf.checksofthyphen",function(v)
 check_soft_hyphen=v 
end)
local function replaced(list,index,replacement)
 if type(list)=="number" then
  return replacement
 elseif type(replacement)=="table" then
  local t={}
  local n=index-1
  for i=1,n do
   t[i]=list[i]
  end
  for i=1,#replacement do
   n=n+1
   t[n]=replacement[i]
  end
  for i=index+1,#list do
   n=n+1
   t[n]=list[i]
  end
 else
  list[index]=replacement
  return list
 end
end
local function unifyresources(fontdata,indices)
 local descriptions=fontdata.descriptions
 local resources=fontdata.resources
 if not descriptions or not resources then
  return
 end
 local nofindices=#indices
 local variants=fontdata.resources.variants
 if variants then
  for selector,unicodes in next,variants do
   for unicode,index in next,unicodes do
    unicodes[unicode]=indices[index]
   end
  end
 end
 local function remark(marks)
  if marks then
   local newmarks={}
   for k,v in next,marks do
    local u=indices[k]
    if u then
     newmarks[u]=v
    elseif trace_optimizations then
     report_optimizations("discarding mark %i",k)
    end
   end
   return newmarks
  end
 end
 local marks=resources.marks
 if marks then
  resources.marks=remark(marks)
 end
 local markclasses=resources.markclasses
 if markclasses then
  for class,marks in next,markclasses do
   markclasses[class]=remark(marks)
  end
 end
 local marksets=resources.marksets
 if marksets then
  for class,marks in next,marksets do
   marksets[class]=remark(marks)
  end
 end
 local done={}
 local duplicates=check_duplicates and resources.duplicates
 if duplicates and not next(duplicates) then
  duplicates=false
 end
 local function recover(cover) 
  for i=1,#cover do
   local c=cover[i]
   if not done[c] then
    local t={}
    for k,v in next,c do
     local ug=indices[k]
     if ug then
      t[ug]=v
     else
      report_error("case %i, bad index in unifying %s: %s of %s",1,"coverage",k,nofindices)
     end
    end
    cover[i]=t
    done[c]=d
   end
  end
 end
 local function recursed(c,kind) 
  local t={}
  for g,d in next,c do
   if type(d)=="table" then
    local ug=indices[g]
    if ug then
     t[ug]=recursed(d,kind)
    else
     report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g,nofindices)
    end
   else
    t[g]=indices[d] 
   end
  end
  return t
 end
 local function unifythem(sequences)
  if not sequences then
   return
  end
  for i=1,#sequences do
   local sequence=sequences[i]
   local kind=sequence.type
   local steps=sequence.steps
   local features=sequence.features
   if steps then
    for i=1,#steps do
     local step=steps[i]
     if kind=="gsub_single" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        if duplicates then
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           local ud1=indices[d1]
           if ud1 then
            t1[ug1]=ud1
            local dg1=duplicates[ug1]
            if dg1 then
             for u in next,dg1 do
              t1[u]=ud1
             end
            end
           else
            report_error("case %i, bad index in unifying %s: %s of %s",3,kind,d1,nofindices)
           end
          else
           report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g1,nofindices)
          end
         end
        else
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=indices[d1]
          else
           report_error("fuzzy case %i in unifying %s: %i",2,kind,g1)
          end
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
     elseif kind=="gpos_pair" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        for g1,d1 in next,c do
         local ug1=indices[g1]
         if ug1 then
          local t2=done[d1]
          if not t2 then
           t2={}
           for g2,d2 in next,d1 do
            local ug2=indices[g2]
            if ug2 then
             t2[ug2]=d2
            else
             report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g2,nofindices,nofindices)
            end
           end
           done[d1]=t2
          end
          t1[ug1]=t2
         else
          report_error("case %i, bad index in unifying %s: %s of %s",2,kind,g1,nofindices)
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
     elseif kind=="gsub_ligature" then
      local c=step.coverage
      if c then
       step.coverage=recursed(c,kind)
      end
     elseif kind=="gsub_alternate" or kind=="gsub_multiple" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        if duplicates then
         for g1,d1 in next,c do
          for i=1,#d1 do
           local d1i=d1[i]
           local d1u=indices[d1i]
           if d1u then
            d1[i]=d1u
           else
            report_error("case %i, bad index in unifying %s: %s of %s",1,kind,i,d1i,nofindices)
           end
          end
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=d1
           local dg1=duplicates[ug1]
           if dg1 then
            for u in next,dg1 do
             t1[u]=copy(d1)
            end
           end
          else
           report_error("case %i, bad index in unifying %s: %s of %s",2,kind,g1,nofindices)
          end
         end
        else
         for g1,d1 in next,c do
          for i=1,#d1 do
           local d1i=d1[i]
           local d1u=indices[d1i]
           if d1u then
            d1[i]=d1u
           else
            report_error("case %i, bad index in unifying %s: %s of %s",2,kind,d1i,nofindices)
           end
          end
          t1[indices[g1]]=d1
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
     elseif kind=="gpos_single" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        if duplicates then
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=d1
           local dg1=duplicates[ug1]
           if dg1 then
            for u in next,dg1 do
             t1[u]=d1
            end
           end
          else
           report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g1,nofindices)
          end
         end
        else
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=d1
          else
           report_error("case %i, bad index in unifying %s: %s of %s",2,kind,g1,nofindices)
          end
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
     elseif kind=="gpos_mark2base" or kind=="gpos_mark2mark" or kind=="gpos_mark2ligature" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        for g1,d1 in next,c do
         local ug1=indices[g1]
         if ug1 then
          t1[ug1]=d1
         else
          report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g1,nofindices)
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
      local c=step.baseclasses
      if c then
       local t1=done[c]
       if not t1 then
        for g1,d1 in next,c do
         local t2=done[d1]
         if not t2 then
          t2={}
          for g2,d2 in next,d1 do
           local ug2=indices[g2]
           if ug2 then
            t2[ug2]=d2
           else
            report_error("case %i, bad index in unifying %s: %s of %s",2,kind,g2,nofindices)
           end
          end
          done[d1]=t2
         end
         c[g1]=t2
        end
        done[c]=c
       end
      end
     elseif kind=="gpos_cursive" then
      local c=step.coverage
      if c then
       local t1=done[c]
       if not t1 then
        t1={}
        if duplicates then
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=d1
           local dg1=duplicates[ug1]
           if dg1 then
            for u in next,dg1 do
             t1[u]=copy(d1)
            end
           end
          else
           report_error("case %i, bad index in unifying %s: %s of %s",1,kind,g1,nofindices)
          end
         end
        else
         for g1,d1 in next,c do
          local ug1=indices[g1]
          if ug1 then
           t1[ug1]=d1
          else
           report_error("case %i, bad index in unifying %s: %s of %s",2,kind,g1,nofindices)
          end
         end
        end
        done[c]=t1
       end
       step.coverage=t1
      end
     end
     local rules=step.rules
     if rules then
      for i=1,#rules do
       local rule=rules[i]
       local before=rule.before   if before  then recover(before)  end
       local after=rule.after if after   then recover(after)   end
       local current=rule.current  if current then recover(current) end
       local replacements=rule.replacements
       if replacements then
        if not done[replacements] then
         local r={}
         for k,v in next,replacements do
          r[indices[k]]=indices[v]
         end
         rule.replacements=r
         done[replacements]=r
        end
       end
      end
     end
    end
   end
    end
 end
 unifythem(resources.sequences)
 unifythem(resources.sublookups)
end
local function copyduplicates(fontdata)
 if check_duplicates then
  local descriptions=fontdata.descriptions
  local resources=fontdata.resources
  local duplicates=resources.duplicates
  if check_soft_hyphen then
   local dh=descriptions[0x2D]
   if dh then
    local ds=descriptions[0xAD]
    if not ds or ds.width~=dh.width then
     descriptions[0xAD]=nil
     if ds then
      if trace_unicodes then
       report_unicodes("patching soft hyphen")
      end
     else
      if trace_unicodes then
       report_unicodes("adding soft hyphen")
      end
     end
     if not duplicates then
      duplicates={}
      resources.duplicates=duplicates
     end
     local d=duplicates[0x2D]
     if d then
      d[0xAD]=true
     else
      duplicates[0x2D]={ [0xAD]=true }
     end
    end
   end
  end
  if duplicates then
     for u,d in next,duplicates do
    local du=descriptions[u]
    if du then
     local t={ f_character_y(u),"@",f_index(du.index),"->" }
     local n=0
     local m=25
     for u in next,d do
      if descriptions[u] then
       if n<m then
        t[n+4]=f_character_n(u)
       end
      else
       local c=copy(du)
       c.unicode=u 
       descriptions[u]=c
       if n<m then
        t[n+4]=f_character_y(u)
       end
      end
      n=n+1
     end
     if trace_unicodes then
      if n<=m then
       report_unicodes("%i : % t",n,t)
      else
       report_unicodes("%i : % t ...",n,t)
      end
     end
    else
    end
   end
  end
 end
end
local ignore={ 
 ["notdef"]=true,
 [".notdef"]=true,
 ["null"]=true,
 [".null"]=true,
 ["nonmarkingreturn"]=true,
}
local function checklookups(fontdata,missing,nofmissing)
 local descriptions=fontdata.descriptions
 local resources=fontdata.resources
 if missing and nofmissing and nofmissing<=0 then
  return
 end
 local singles={}
 local alternates={}
 local ligatures={}
 if not missing then
  missing={}
  nofmissing=0
  for u,d in next,descriptions do
   if not d.unicode then
    nofmissing=nofmissing+1
    missing[u]=true
   end
  end
 end
 local function collectthem(sequences)
  if not sequences then
   return
  end
  for i=1,#sequences do
   local sequence=sequences[i]
   local kind=sequence.type
   local steps=sequence.steps
   if steps then
    for i=1,#steps do
     local step=steps[i]
     if kind=="gsub_single" then
      local c=step.coverage
      if c then
       singles[#singles+1]=c
      end
     elseif kind=="gsub_alternate" then
      local c=step.coverage
      if c then
       alternates[#alternates+1]=c
      end
     elseif kind=="gsub_ligature" then
      local c=step.coverage
      if c then
       ligatures[#ligatures+1]=c
      end
     end
    end
   end
  end
 end
 collectthem(resources.sequences)
 collectthem(resources.sublookups)
 local loops=0
 while true do
  loops=loops+1
  local old=nofmissing
  for i=1,#singles do
   local c=singles[i]
   for g1,g2 in next,c do
    if missing[g1] then
     local u2=descriptions[g2].unicode
     if u2 then
      missing[g1]=false
      descriptions[g1].unicode=u2
      nofmissing=nofmissing-1
     end
    end
    if missing[g2] then
     local u1=descriptions[g1].unicode
     if u1 then
      missing[g2]=false
      descriptions[g2].unicode=u1
      nofmissing=nofmissing-1
     end
    end
   end
  end
  for i=1,#alternates do
   local c=alternates[i]
   for g1,d1 in next,c do
    if missing[g1] then
     for i=1,#d1 do
      local g2=d1[i]
      local u2=descriptions[g2].unicode
      if u2 then
       missing[g1]=false
       descriptions[g1].unicode=u2
       nofmissing=nofmissing-1
      end
     end
    end
    if not missing[g1] then
     for i=1,#d1 do
      local g2=d1[i]
      if missing[g2] then
       local u1=descriptions[g1].unicode
       if u1 then
        missing[g2]=false
        descriptions[g2].unicode=u1
        nofmissing=nofmissing-1
       end
      end
     end
    end
   end
  end
  if nofmissing<=0 then
   if trace_unicodes then
    report_unicodes("all missings done in %s loops",loops)
   end
   return
  elseif old==nofmissing then
   break
  end
 end
 local t,n 
 local function recursed(c)
  for g,d in next,c do
   if g~="ligature" then
    local u=descriptions[g].unicode
    if u then
     n=n+1
     t[n]=u
     recursed(d)
     n=n-1
    end
   elseif missing[d] then
    local l={}
    local m=0
    for i=1,n do
     local u=t[i]
     if type(u)=="table" then
      for i=1,#u do
       m=m+1
       l[m]=u[i]
      end
     else
      m=m+1
      l[m]=u
     end
    end
    missing[d]=false
    descriptions[d].unicode=l
    nofmissing=nofmissing-1
   end
  end
 end
 if nofmissing>0 then
  t={}
  n=0
  local loops=0
  while true do
   loops=loops+1
   local old=nofmissing
   for i=1,#ligatures do
    recursed(ligatures[i])
   end
   if nofmissing<=0 then
    if trace_unicodes then
     report_unicodes("all missings done in %s loops",loops)
    end
    return
   elseif old==nofmissing then
    break
   end
  end
  t=nil
  n=0
 end
 if trace_unicodes and nofmissing>0 then
  local done={}
  for i,r in next,missing do
   if r then
    local data=descriptions[i]
    local name=data and data.name or f_index(i)
    if not ignore[name] then
     done[name]=true
    end
   end
  end
  if next(done) then
   report_unicodes("not unicoded: % t",sortedkeys(done))
  end
 end
end
local firstprivate=fonts.privateoffsets and fonts.privateoffsets.textbase or 0xF0000
local puafirst=0xE000
local pualast=0xF8FF
local function unifymissing(fontdata)
 if not fonts.mappings then
  require("font-map")
  require("font-agl")
 end
 local unicodes={}
 local resources=fontdata.resources
 resources.unicodes=unicodes
 for unicode,d in next,fontdata.descriptions do
  if unicode<privateoffset then
   if unicode>=puafirst and unicode<=pualast then
   else
    local name=d.name
    if name then
     unicodes[name]=unicode
    end
   end
  else
  end
 end
 fonts.mappings.addtounicode(fontdata,fontdata.filename,checklookups)
 resources.unicodes=nil
end
local function unifyglyphs(fontdata,usenames)
 local private=fontdata.private or privateoffset
 local glyphs=fontdata.glyphs
 local indices={}
 local descriptions={}
 local names=usenames and {}
 local resources=fontdata.resources
 local zero=glyphs[0]
 local zerocode=zero.unicode
 local nofglyphs=#glyphs
 if not zerocode then
  zerocode=private
  zero.unicode=zerocode
  private=private+1
 end
 descriptions[zerocode]=zero
 if names then
  local name=glyphs[0].name or f_private(zerocode)
  indices[0]=name
  names[name]=zerocode
 else
  indices[0]=zerocode
 end
 if names then
  for index=1,nofglyphs do
   local glyph=glyphs[index]
   local unicode=glyph.unicode 
   if not unicode then
    unicode=private
    local name=glyph.name or f_private(unicode)
    indices[index]=name
    names[name]=unicode
    private=private+1
   elseif unicode>=firstprivate then
    unicode=private
    local name=glyph.name or f_private(unicode)
    indices[index]=name
    names[name]=unicode
    private=private+1
   elseif unicode>=puafirst and unicode<=pualast then
    local name=glyph.name or f_private(unicode)
    indices[index]=name
    names[name]=unicode
   elseif descriptions[unicode] then
    unicode=private
    local name=glyph.name or f_private(unicode)
    indices[index]=name
    names[name]=unicode
    private=private+1
   else
    local name=glyph.name or f_unicode(unicode)
    indices[index]=name
    names[name]=unicode
   end
   descriptions[unicode]=glyph
  end
 elseif trace_unicodes then
  for index=1,nofglyphs do
   local glyph=glyphs[index]
   local unicode=glyph.unicode 
   if not unicode then
    unicode=private
    indices[index]=unicode
    private=private+1
   elseif unicode>=firstprivate then
    local name=glyph.name
    if name then
     report_unicodes("moving glyph %a indexed %05X from private %U to %U ",name,index,unicode,private)
    else
     report_unicodes("moving glyph indexed %05X from private %U to %U ",index,unicode,private)
    end
    unicode=private
    indices[index]=unicode
    private=private+1
   elseif unicode>=puafirst and unicode<=pualast then
    local name=glyph.name
    if name then
     report_unicodes("keeping private unicode %U for glyph %a indexed %05X",unicode,name,index)
    else
     report_unicodes("keeping private unicode %U for glyph indexed %05X",unicode,index)
    end
    indices[index]=unicode
   elseif descriptions[unicode] then
    local name=glyph.name
    if name then
     report_unicodes("assigning duplicate unicode %U to %U for glyph %a indexed %05X ",unicode,private,name,index)
    else
     report_unicodes("assigning duplicate unicode %U to %U for glyph indexed %05X ",unicode,private,index)
    end
    unicode=private
    indices[index]=unicode
    private=private+1
   else
    indices[index]=unicode
   end
   descriptions[unicode]=glyph
  end
 else
  for index=1,nofglyphs do
   local glyph=glyphs[index]
   local unicode=glyph.unicode 
   if not unicode then
    unicode=private
    indices[index]=unicode
    private=private+1
   elseif unicode>=firstprivate then
    local name=glyph.name
    unicode=private
    indices[index]=unicode
    private=private+1
   elseif unicode>=puafirst and unicode<=pualast then
    local name=glyph.name
    indices[index]=unicode
   elseif descriptions[unicode] then
    local name=glyph.name
    unicode=private
    indices[index]=unicode
    private=private+1
   else
    indices[index]=unicode
   end
   descriptions[unicode]=glyph
  end
 end
 for index=1,nofglyphs do
  local math=glyphs[index].math
  if math then
   local list=math.vparts
   if list then
    for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end
   end
   local list=math.hparts
   if list then
    for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end
   end
   local list=math.vvariants
   if list then
    for i=1,#list do list[i]=indices[list[i]] end
   end
   local list=math.hvariants
   if list then
    for i=1,#list do list[i]=indices[list[i]] end
   end
  end
 end
 local colorpalettes=resources.colorpalettes
 if colorpalettes then
  for index=1,nofglyphs do
   local colors=glyphs[index].colors
   if colors then
    for i=1,#colors do
     local c=colors[i]
     c.slot=indices[c.slot]
    end
   end
  end
 end
 fontdata.private=private
 fontdata.glyphs=nil
 fontdata.names=names
 fontdata.descriptions=descriptions
 fontdata.hashmethod=hashmethod
 fontdata.nofglyphs=nofglyphs
 return indices,names
end
local p_crappyname  do
 local p_hex=R("af","AF","09")
 local p_digit=R("09")
 local p_done=S("._-")^0+P(-1)
 local p_alpha=R("az","AZ")
 local p_ALPHA=R("AZ")
 p_crappyname=(
  lpeg.utfchartabletopattern({ "uni","u" },true)*S("Xx_")^0*p_hex^1
+lpeg.utfchartabletopattern({ "identity","glyph","jamo" },true)*p_hex^1
+lpeg.utfchartabletopattern({ "index","afii" },true)*p_digit^1
+p_digit*p_hex^3+p_alpha*p_digit^1
+P("aj")*p_digit^1+P("eh_")*(p_digit^1+p_ALPHA*p_digit^1)+(1-P("_"))^1*P("_uni")*p_hex^1+P("_")*P(1)^1
 )*p_done
end
local forcekeep=false 
directives.register("otf.keepnames",function(v)
 report_cleanup("keeping weird glyph names, expect larger files and more memory usage")
 forcekeep=v
end)
local function stripredundant(fontdata)
 local descriptions=fontdata.descriptions
 if descriptions then
  local n=0
  local c=0
  if (not context and fonts.privateoffsets.keepnames) or forcekeep then
   for unicode,d in next,descriptions do
    if d.class=="base" then
     d.class=nil
     c=c+1
    end
   end
  else
   for unicode,d in next,descriptions do
    local name=d.name
    if name and lpegmatch(p_crappyname,name) then
     d.name=nil
     n=n+1
    end
    if d.class=="base" then
     d.class=nil
     c=c+1
    end
   end
  end
  if trace_cleanup then
   if n>0 then
    report_cleanup("%s bogus names removed (verbose unicode)",n)
   end
   if c>0 then
    report_cleanup("%s base class tags removed (default is base)",c)
   end
  end
 end
end
readers.stripredundant=stripredundant
function readers.getcomponents(fontdata) 
 local resources=fontdata.resources
 if resources then
  local sequences=resources.sequences
  if sequences then
   local collected={}
   for i=1,#sequences do
    local sequence=sequences[i]
    if sequence.type=="gsub_ligature" then
     local steps=sequence.steps
     if steps then
      local l={}
      local function traverse(p,k,v)
       if k=="ligature" then
        collected[v]={ unpack(l) }
       elseif tonumber(v) then
        insert(l,k)
        collected[v]={ unpack(l) }
        remove(l)
       else
        insert(l,k)
        for k,vv in next,v do
         traverse(p,k,vv)
        end
        remove(l)
       end
      end
      for i=1,#steps do
       local c=steps[i].coverage
       if c then
        for k,v in next,c do
         traverse(k,k,v)
        end
       end
      end
     end
    end
   end
   if next(collected) then
    while true do
     local done=false
     for k,v in next,collected do
      for i=1,#v do
       local vi=v[i]
       if vi==k then
        collected[k]=nil
        break
       else
        local c=collected[vi]
        if c then
         done=true
         local t={}
         local n=i-1
         for j=1,n do
          t[j]=v[j]
         end
         for j=1,#c do
          n=n+1
          t[n]=c[j]
         end
         for j=i+1,#v do
          n=n+1
          t[n]=v[j]
         end
         collected[k]=t
         break
        end
       end
      end
     end
     if not done then
      break
     end
    end
    return collected
   end
  end
 end
end
readers.unifymissing=unifymissing
function readers.rehash(fontdata,hashmethod) 
 if not (fontdata and fontdata.glyphs) then
  return
 end
 if hashmethod=="indices" then
  fontdata.hashmethod="indices"
 elseif hashmethod=="names" then
  fontdata.hashmethod="names"
  local indices=unifyglyphs(fontdata,true)
  unifyresources(fontdata,indices)
  copyduplicates(fontdata)
  unifymissing(fontdata)
 else
  fontdata.hashmethod="unicodes"
  local indices=unifyglyphs(fontdata)
  unifyresources(fontdata,indices)
  copyduplicates(fontdata)
  unifymissing(fontdata)
  stripredundant(fontdata)
 end
end
function readers.checkhash(fontdata)
 local hashmethod=fontdata.hashmethod
 if hashmethod=="unicodes" then
  fontdata.names=nil 
 elseif hashmethod=="names" and fontdata.names then
  unifyresources(fontdata,fontdata.names)
  copyduplicates(fontdata)
  fontdata.hashmethod="unicodes"
  fontdata.names=nil 
 else
  readers.rehash(fontdata,"unicodes")
 end
end
function readers.addunicodetable(fontdata)
 local resources=fontdata.resources
 local unicodes=resources.unicodes
 if not unicodes then
  local descriptions=fontdata.descriptions
  if descriptions then
   unicodes={}
   resources.unicodes=unicodes
   for u,d in next,descriptions do
    local n=d.name
    if n then
     unicodes[n]=u
    end
   end
  end
 end
end
local concat,sort=table.concat,table.sort
local next,type,tostring=next,type,tostring
local criterium=1
local threshold=0
local trace_packing=false  trackers.register("otf.packing",function(v) trace_packing=v end)
local trace_loading=false  trackers.register("otf.loading",function(v) trace_loading=v end)
local report_otf=logs.reporter("fonts","otf loading")
local function tabstr_normal(t)
 local s={}
 local n=0
 for k,v in next,t do
  n=n+1
  if type(v)=="table" then
   s[n]=k..">"..tabstr_normal(v)
  elseif v==true then
   s[n]=k.."+" 
  elseif v then
   s[n]=k.."="..v
  else
   s[n]=k.."-" 
  end
 end
 if n==0 then
  return ""
 elseif n==1 then
  return s[1]
 else
  sort(s) 
  return concat(s,",")
 end
end
local function tabstr_flat(t)
 local s={}
 local n=0
 for k,v in next,t do
  n=n+1
  s[n]=k.."="..v
 end
 if n==0 then
  return ""
 elseif n==1 then
  return s[1]
 else
  sort(s) 
  return concat(s,",")
 end
end
local function tabstr_mixed(t) 
 local n=#t
 if n==0 then
  return ""
 elseif n==1 then
  local k=t[1]
  if k==true then
   return "++" 
  elseif k==false then
   return "--" 
  else
   return tostring(k) 
  end
 else
  local s={}
  for i=1,n do
   local k=t[i]
   if k==true then
    s[i]="++" 
   elseif k==false then
    s[i]="--" 
   else
    s[i]=k 
   end
  end
  return concat(s,",")
 end
end
local function tabstr_boolean(t)
 local s={}
 local n=0
 for k,v in next,t do
  n=n+1
  if v then
   s[n]=k.."+"
  else
   s[n]=k.."-"
  end
 end
 if n==0 then
  return ""
 elseif n==1 then
  return s[1]
 else
  sort(s) 
  return concat(s,",")
 end
end
function readers.pack(data)
 if data then
  local h,t,c={},{},{}
  local hh,tt,cc={},{},{}
  local nt,ntt=0,0
  local function pack_normal(v)
   local tag=tabstr_normal(v)
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_normal_cc(v)
   local tag=tabstr_normal(v)
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    v[1]=0
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_flat(v)
   local tag=tabstr_flat(v)
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_indexed(v)
   local tag=concat(v," ")
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_mixed(v)
   local tag=tabstr_mixed(v)
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_boolean(v)
   local tag=tabstr_boolean(v)
   local ht=h[tag]
   if ht then
    c[ht]=c[ht]+1
    return ht
   else
    nt=nt+1
    t[nt]=v
    h[tag]=nt
    c[nt]=1
    return nt
   end
  end
  local function pack_final(v)
   if c[v]<=criterium then
    return t[v]
   else
    local hv=hh[v]
    if hv then
     return hv
    else
     ntt=ntt+1
     tt[ntt]=t[v]
     hh[v]=ntt
     cc[ntt]=c[v]
     return ntt
    end
   end
  end
  local function pack_final_cc(v)
   if c[v]<=criterium then
    return t[v]
   else
    local hv=hh[v]
    if hv then
     return hv
    else
     ntt=ntt+1
     tt[ntt]=t[v]
     hh[v]=ntt
     cc[ntt]=c[v]
     return ntt
    end
   end
  end
  local function success(stage,pass)
   if nt==0 then
    if trace_loading or trace_packing then
     report_otf("pack quality: nothing to pack")
    end
    return false
   elseif nt>=threshold then
    local one=0
    local two=0
    local rest=0
    if pass==1 then
     for k,v in next,c do
      if v==1 then
       one=one+1
      elseif v==2 then
       two=two+1
      else
       rest=rest+1
      end
     end
    else
     for k,v in next,cc do
      if v>20 then
       rest=rest+1
      elseif v>10 then
       two=two+1
      else
       one=one+1
      end
     end
     data.tables=tt
    end
    if trace_loading or trace_packing then
     report_otf("pack quality: stage %s, pass %s, %s packed, 1-10:%s, 11-20:%s, rest:%s (criterium: %s)",
      stage,pass,one+two+rest,one,two,rest,criterium)
    end
    return true
   else
    if trace_loading or trace_packing then
     report_otf("pack quality: stage %s, pass %s, %s packed, aborting pack (threshold: %s)",
      stage,pass,nt,threshold)
    end
    return false
   end
  end
  local function packers(pass)
   if pass==1 then
    return pack_normal,pack_indexed,pack_flat,pack_boolean,pack_mixed,pack_normal_cc
   else
    return pack_final,pack_final,pack_final,pack_final,pack_final,pack_final_cc
   end
  end
  local resources=data.resources
  local sequences=resources.sequences
  local sublookups=resources.sublookups
  local features=resources.features
  local palettes=resources.colorpalettes
  local variable=resources.variabledata
  local chardata=characters and characters.data
  local descriptions=data.descriptions or data.glyphs
  if not descriptions then
   return
  end
  for pass=1,2 do
   if trace_packing then
    report_otf("start packing: stage 1, pass %s",pass)
   end
   local pack_normal,pack_indexed,pack_flat,pack_boolean,pack_mixed,pack_normal_cc=packers(pass)
   for unicode,description in next,descriptions do
    local boundingbox=description.boundingbox
    if boundingbox then
     description.boundingbox=pack_indexed(boundingbox)
    end
    local math=description.math
    if math then
     local kerns=math.kerns
     if kerns then
      for tag,kern in next,kerns do
       kerns[tag]=pack_normal(kern)
      end
     end
    end
   end
   local function packthem(sequences)
    for i=1,#sequences do
     local sequence=sequences[i]
     local kind=sequence.type
     local steps=sequence.steps
     local order=sequence.order
     local features=sequence.features
     local flags=sequence.flags
     if steps then
      for i=1,#steps do
       local step=steps[i]
       if kind=="gpos_pair" then
        local c=step.coverage
        if c then
         if step.format~="pair" then
          for g1,d1 in next,c do
           c[g1]=pack_normal(d1)
          end
         elseif step.shared then
          local shared={}
          for g1,d1 in next,c do
           for g2,d2 in next,d1 do
            if not shared[d2] then
             local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end
             local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end
             shared[d2]=true
            end
           end
          end
          if pass==2 then
           step.shared=nil 
          end
         else
          for g1,d1 in next,c do
           for g2,d2 in next,d1 do
            local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end
            local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end
           end
          end
         end
        end
       elseif kind=="gpos_single" then
        local c=step.coverage
        if c then
         if step.format=="single" then
          for g1,d1 in next,c do
           if d1 and d1~=true then
            c[g1]=pack_indexed(d1)
           end
          end
         else
          step.coverage=pack_normal(c)
         end
        end
       elseif kind=="gpos_cursive" then
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          local f=d1[2] if f then d1[2]=pack_indexed(f) end
          local s=d1[3] if s then d1[3]=pack_indexed(s) end
         end
        end
       elseif kind=="gpos_mark2base" or kind=="gpos_mark2mark" then
        local c=step.baseclasses
        if c then
         for g1,d1 in next,c do
          for g2,d2 in next,d1 do
           d1[g2]=pack_indexed(d2)
          end
         end
        end
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          d1[2]=pack_indexed(d1[2])
         end
        end
       elseif kind=="gpos_mark2ligature" then
        local c=step.baseclasses
        if c then
         for g1,d1 in next,c do
          for g2,d2 in next,d1 do
           for g3,d3 in next,d2 do
            d2[g3]=pack_indexed(d3)
           end
          end
         end
        end
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          d1[2]=pack_indexed(d1[2])
         end
        end
       end
       local rules=step.rules
       if rules then
        for i=1,#rules do
         local rule=rules[i]
         local r=rule.before    if r then for i=1,#r do r[i]=pack_boolean(r[i]) end end
         local r=rule.after  if r then for i=1,#r do r[i]=pack_boolean(r[i]) end end
         local r=rule.current   if r then for i=1,#r do r[i]=pack_boolean(r[i]) end end
         local r=rule.replacements if r then rule.replacements=pack_flat   (r) end
        end
       end
      end
     end
     if order then
      sequence.order=pack_indexed(order)
     end
     if features then
      for script,feature in next,features do
       features[script]=pack_normal(feature)
      end
     end
     if flags then
      sequence.flags=pack_normal(flags)
     end
      end
   end
   if sequences then
    packthem(sequences)
   end
   if sublookups then
    packthem(sublookups)
   end
   if features then
    for k,list in next,features do
     for feature,spec in next,list do
      list[feature]=pack_normal(spec)
     end
    end
   end
   if palettes then
    for i=1,#palettes do
     local p=palettes[i]
     for j=1,#p do
      p[j]=pack_indexed(p[j])
     end
    end
   end
   if variable then
    local instances=variable.instances
    if instances then
     for i=1,#instances do
      local v=instances[i].values
      for j=1,#v do
       v[j]=pack_normal(v[j])
      end
     end
    end
    local function packdeltas(main)
     if main then
      local deltas=main.deltas
      if deltas then
       for i=1,#deltas do
        local di=deltas[i]
        local d=di.deltas
        for j=1,#d do
         d[j]=pack_indexed(d[j])
        end
        di.regions=pack_indexed(di.regions)
       end
      end
      local regions=main.regions
      if regions then
       for i=1,#regions do
        local r=regions[i]
        for j=1,#r do
         r[j]=pack_normal(r[j])
        end
       end
      end
     end
    end
    packdeltas(variable.global)
    packdeltas(variable.horizontal)
    packdeltas(variable.vertical)
    packdeltas(variable.metrics)
   end
   if not success(1,pass) then
    return
   end
  end
  if nt>0 then
   for pass=1,2 do
    if trace_packing then
     report_otf("start packing: stage 2, pass %s",pass)
    end
    local pack_normal,pack_indexed,pack_flat,pack_boolean,pack_mixed,pack_normal_cc=packers(pass)
    for unicode,description in next,descriptions do
     local math=description.math
     if math then
      local kerns=math.kerns
      if kerns then
       math.kerns=pack_normal(kerns)
      end
     end
    end
    local function packthem(sequences)
     for i=1,#sequences do
      local sequence=sequences[i]
      local kind=sequence.type
      local steps=sequence.steps
      local features=sequence.features
      if steps then
       for i=1,#steps do
        local step=steps[i]
        if kind=="gpos_pair" then
         local c=step.coverage
         if c then
          if step.format=="pair" then
           for g1,d1 in next,c do
            for g2,d2 in next,d1 do
             d1[g2]=pack_normal(d2)
            end
           end
          end
         end
        elseif kind=="gpos_mark2ligature" then
         local c=step.baseclasses 
         if c then
          for g1,d1 in next,c do
           for g2,d2 in next,d1 do
            d1[g2]=pack_normal(d2)
           end
          end
         end
        end
        local rules=step.rules
        if rules then
         for i=1,#rules do
          local rule=rules[i]
          local r=rule.before  if r then rule.before=pack_normal(r) end
          local r=rule.after   if r then rule.after=pack_normal(r) end
          local r=rule.current if r then rule.current=pack_normal(r) end
         end
        end
       end
      end
      if features then
       sequence.features=pack_normal(features)
      end
       end
    end
    if sequences then
     packthem(sequences)
    end
    if sublookups then
     packthem(sublookups)
    end
    if variable then
     local function unpackdeltas(main)
      if main then
       local regions=main.regions
       if regions then
        main.regions=pack_normal(regions)
       end
      end
     end
     unpackdeltas(variable.global)
     unpackdeltas(variable.horizontal)
     unpackdeltas(variable.vertical)
     unpackdeltas(variable.metrics)
    end
   end
   for pass=1,2 do
    if trace_packing then
     report_otf("start packing: stage 3, pass %s",pass)
    end
    local pack_normal,pack_indexed,pack_flat,pack_boolean,pack_mixed,pack_normal_cc=packers(pass)
    local function packthem(sequences)
     for i=1,#sequences do
      local sequence=sequences[i]
      local kind=sequence.type
      local steps=sequence.steps
      local features=sequence.features
      if steps then
       for i=1,#steps do
        local step=steps[i]
        if kind=="gpos_pair" then
         local c=step.coverage
         if c then
          if step.format=="pair" then
           for g1,d1 in next,c do
            c[g1]=pack_normal(d1)
           end
          end
         end
        elseif kind=="gpos_cursive" then
         local c=step.coverage
         if c then
          for g1,d1 in next,c do
           c[g1]=pack_normal_cc(d1)
          end
         end
        end
       end
      end
     end
    end
    if sequences then
     packthem(sequences)
    end
    if sublookups then
     packthem(sublookups)
    end
   end
  end
 end
end
local unpacked_mt={
 __index=function(t,k)
   t[k]=false
   return k 
  end
}
function readers.unpack(data)
 if data then
  local tables=data.tables
  if tables then
   local resources=data.resources
   local descriptions=data.descriptions or data.glyphs
   local sequences=resources.sequences
   local sublookups=resources.sublookups
   local features=resources.features
   local palettes=resources.colorpalettes
   local variable=resources.variabledata
   local unpacked={}
   setmetatable(unpacked,unpacked_mt)
   for unicode,description in next,descriptions do
    local tv=tables[description.boundingbox]
    if tv then
     description.boundingbox=tv
    end
    local math=description.math
    if math then
     local kerns=math.kerns
     if kerns then
      local tm=tables[kerns]
      if tm then
       math.kerns=tm
       kerns=unpacked[tm]
      end
      if kerns then
       for k,kern in next,kerns do
        local tv=tables[kern]
        if tv then
         kerns[k]=tv
        end
       end
      end
     end
    end
   end
   local function unpackthem(sequences)
    for i=1,#sequences do
     local sequence=sequences[i]
     local kind=sequence.type
     local steps=sequence.steps
     local order=sequence.order
     local features=sequence.features
     local flags=sequence.flags
     local markclass=sequence.markclass
     if features then
      local tv=tables[features]
      if tv then
       sequence.features=tv
       features=tv
      end
      for script,feature in next,features do
       local tv=tables[feature]
       if tv then
        features[script]=tv
       end
      end
     end
     if steps then
      for i=1,#steps do
       local step=steps[i]
       if kind=="gpos_pair" then
        local c=step.coverage
        if c then
         if step.format=="pair" then
          for g1,d1 in next,c do
           local tv=tables[d1]
           if tv then
            c[g1]=tv
            d1=tv
           end
           for g2,d2 in next,d1 do
            local tv=tables[d2]
            if tv then
             d1[g2]=tv
             d2=tv
            end
            local f=tables[d2[1]] if f then d2[1]=f end
            local s=tables[d2[2]] if s then d2[2]=s end
           end
          end
         else
          for g1,d1 in next,c do
           local tv=tables[d1]
           if tv then
            c[g1]=tv
           end
          end
         end
        end
       elseif kind=="gpos_single" then
        local c=step.coverage
        if c then
         if step.format=="single" then
          for g1,d1 in next,c do
           local tv=tables[d1]
           if tv then
            c[g1]=tv
           end
          end
         else
          local tv=tables[c]
          if tv then
           step.coverage=tv
          end
         end
        end
       elseif kind=="gpos_cursive" then
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          local tv=tables[d1]
          if tv then
           d1=tv
           c[g1]=d1
          end
          local f=tables[d1[2]] if f then d1[2]=f end
          local s=tables[d1[3]] if s then d1[3]=s end
         end
        end
       elseif kind=="gpos_mark2base" or kind=="gpos_mark2mark" then
        local c=step.baseclasses
        if c then
         for g1,d1 in next,c do
          for g2,d2 in next,d1 do
           local tv=tables[d2]
           if tv then
            d1[g2]=tv
           end
          end
         end
        end
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          local tv=tables[d1[2]]
          if tv then
           d1[2]=tv
          end
         end
        end
       elseif kind=="gpos_mark2ligature" then
        local c=step.baseclasses
        if c then
         for g1,d1 in next,c do
          for g2,d2 in next,d1 do
           local tv=tables[d2] 
           if tv then
            d2=tv
            d1[g2]=d2
           end
           for g3,d3 in next,d2 do
            local tv=tables[d2[g3]]
            if tv then
             d2[g3]=tv
            end
           end
          end
         end
        end
        local c=step.coverage
        if c then
         for g1,d1 in next,c do
          local tv=tables[d1[2]]
          if tv then
           d1[2]=tv
          end
         end
        end
       end
       local rules=step.rules
       if rules then
        for i=1,#rules do
         local rule=rules[i]
         local before=rule.before
         if before then
          local tv=tables[before]
          if tv then
           rule.before=tv
           before=tv
          end
          for i=1,#before do
           local tv=tables[before[i]]
           if tv then
            before[i]=tv
           end
          end
         end
         local after=rule.after
         if after then
          local tv=tables[after]
          if tv then
           rule.after=tv
           after=tv
          end
          for i=1,#after do
           local tv=tables[after[i]]
           if tv then
            after[i]=tv
           end
          end
         end
         local current=rule.current
         if current then
          local tv=tables[current]
          if tv then
           rule.current=tv
           current=tv
          end
          for i=1,#current do
           local tv=tables[current[i]]
           if tv then
            current[i]=tv
           end
          end
         end
         local replacements=rule.replacements
         if replacements then
          local tv=tables[replacements]
          if tv then
           rule.replacements=tv
          end
         end
        end
       end
      end
     end
     if order then
      local tv=tables[order]
      if tv then
       sequence.order=tv
      end
     end
     if flags then
      local tv=tables[flags]
      if tv then
       sequence.flags=tv
      end
     end
      end
   end
   if sequences then
    unpackthem(sequences)
   end
   if sublookups then
    unpackthem(sublookups)
   end
   if features then
    for k,list in next,features do
     for feature,spec in next,list do
      local tv=tables[spec]
      if tv then
       list[feature]=tv
      end
     end
    end
   end
   if palettes then
    for i=1,#palettes do
     local p=palettes[i]
     for j=1,#p do
      local tv=tables[p[j]]
      if tv then
       p[j]=tv
      end
     end
    end
   end
   if variable then
    local instances=variable.instances
    if instances then
     for i=1,#instances do
      local v=instances[i].values
      for j=1,#v do
       local tv=tables[v[j]]
       if tv then
        v[j]=tv
       end
      end
     end
    end
    local function unpackdeltas(main)
     if main then
      local deltas=main.deltas
      if deltas then
       for i=1,#deltas do
        local di=deltas[i]
        local d=di.deltas
        local r=di.regions
        for j=1,#d do
         local tv=tables[d[j]]
         if tv then
          d[j]=tv
         end
        end
        local tv=di.regions
        if tv then
         di.regions=tv
        end
       end
      end
      local regions=main.regions
      if regions then
       local tv=tables[regions]
       if tv then
        main.regions=tv
        regions=tv
       end
       for i=1,#regions do
        local r=regions[i]
        for j=1,#r do
         local tv=tables[r[j]]
         if tv then
          r[j]=tv
         end
        end
       end
      end
     end
    end
    unpackdeltas(variable.global)
    unpackdeltas(variable.horizontal)
    unpackdeltas(variable.vertical)
    unpackdeltas(variable.metrics)
   end
   data.tables=nil
  end
 end
end
local mt={
 __index=function(t,k) 
  if k=="height" then
   local ht=t.boundingbox[4]
   return ht<0 and 0 or ht
  elseif k=="depth" then
   local dp=-t.boundingbox[2]
   return dp<0 and 0 or dp
  elseif k=="width" then
   return 0
  elseif k=="name" then 
   return forcenotdef and ".notdef"
  end
 end
}
local function sameformat(sequence,steps,first,nofsteps,kind)
 return true
end
local function mergesteps_1(lookup,strict)
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local first=steps[1]
 if strict then
  local f=first.format
  for i=2,nofsteps do
   if steps[i].format~=f then
    if trace_optimizations then
     report_optimizations("not merging %a steps of %a lookup %a, different formats",nofsteps,lookup.type,lookup.name)
    end
    return 0
   end
  end
 end
 if trace_optimizations then
  report_optimizations("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
 end
 local target=first.coverage
 for i=2,nofsteps do
  local c=steps[i].coverage
  if c then
   for k,v in next,c do
    if not target[k] then
     target[k]=v
    end
   end
  end
 end
 lookup.nofsteps=1
 lookup.merged=true
 lookup.steps={ first }
 return nofsteps-1
end
local function mergesteps_2(lookup)
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local first=steps[1]
 if strict then
  local f=first.format
  for i=2,nofsteps do
   if steps[i].format~=f then
    if trace_optimizations then
     report_optimizations("not merging %a steps of %a lookup %a, different formats",nofsteps,lookup.type,lookup.name)
    end
    return 0
   end
  end
 end
 if trace_optimizations then
  report_optimizations("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
 end
 local target=first.coverage
 for i=2,nofsteps do
  local c=steps[i].coverage
  if c then
   for k,v in next,c do
    local tk=target[k]
    if tk then
     for kk,vv in next,v do
      if tk[kk]==nil then
       tk[kk]=vv
      end
     end
    else
     target[k]=v
    end
   end
  end
 end
 lookup.nofsteps=1
 lookup.merged=true
 lookup.steps={ first }
 return nofsteps-1
end
local function mergesteps_3(lookup,strict) 
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 if trace_optimizations then
  report_optimizations("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
 end
 local coverage={}
 for i=1,nofsteps do
  local c=steps[i].coverage
  if c then
   for k,v in next,c do
    local tk=coverage[k] 
    if tk then
     if trace_optimizations then
      report_optimizations("quitting merge due to multiple checks")
     end
     return nofsteps
    else
     coverage[k]=v
    end
   end
  end
 end
 local first=steps[1]
 local baseclasses={} 
 for i=1,nofsteps do
  local offset=i*10  
  local step=steps[i]
  for k,v in sortedhash(step.baseclasses) do
   baseclasses[offset+k]=v
  end
  for k,v in next,step.coverage do
   v[1]=offset+v[1]
  end
 end
 first.baseclasses=baseclasses
 first.coverage=coverage
 lookup.nofsteps=1
 lookup.merged=true
 lookup.steps={ first }
 return nofsteps-1
end
local function nested(old,new)
 for k,v in next,old do
  if k=="ligature" then
   if not new.ligature then
    new.ligature=v
   end
  else
   local n=new[k]
   if n then
    nested(v,n)
   else
    new[k]=v
   end
  end
 end
end
local function mergesteps_4(lookup) 
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local first=steps[1]
 if trace_optimizations then
  report_optimizations("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
 end
 local target=first.coverage
 for i=2,nofsteps do
  local c=steps[i].coverage
  if c then
   for k,v in next,c do
    local tk=target[k]
    if tk then
     nested(v,tk)
    else
     target[k]=v
    end
   end
  end
 end
 lookup.nofsteps=1
 lookup.steps={ first }
 return nofsteps-1
end
local function mergesteps_5(lookup) 
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local first=steps[1]
 if trace_optimizations then
  report_optimizations("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
 end
 local target=first.coverage
 local hash=nil
 for k,v in next,target do
  hash=v[1]
  break
 end
 for i=2,nofsteps do
  local c=steps[i].coverage
  if c then
   for k,v in next,c do
    local tk=target[k]
    if tk then
     if not tk[2] then
      tk[2]=v[2]
     end
     if not tk[3] then
      tk[3]=v[3]
     end
    else
     target[k]=v
     v[1]=hash
    end
   end
  end
 end
 lookup.nofsteps=1
 lookup.merged=true
 lookup.steps={ first }
 return nofsteps-1
end
local function checkkerns(lookup)
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local kerned=0
 for i=1,nofsteps do
  local step=steps[i]
  if step.format=="pair" then
   local coverage=step.coverage
   local kerns=true
   for g1,d1 in next,coverage do
    if d1==true then
    elseif not d1 then
    elseif d1[1]~=0 or d1[2]~=0 or d1[4]~=0 then
     kerns=false
     break
    end
   end
   if kerns then
    if trace_optimizations then
     report_optimizations("turning pairs of step %a of %a lookup %a into kerns",i,lookup.type,lookup.name)
    end
    local c={}
    for g1,d1 in next,coverage do
     if d1 and d1~=true then
      c[g1]=d1[3]
     end
    end
    step.coverage=c
    step.format="move"
    kerned=kerned+1
   end
  end
 end
 return kerned
end
local strip_pairs=true
local compact_pairs=true
local compact_singles=true
local merge_pairs=true
local merge_singles=true
local merge_substitutions=true
local merge_alternates=true
local merge_multiples=true
local merge_ligatures=true
local merge_cursives=true
local merge_marks=true
directives.register("otf.strip.pairs",function(v) strip_pairs=v end)
directives.register("otf.compact.pairs",function(v) compact_pairs=v end)
directives.register("otf.compact.singles",function(v) compact_singles=v end)
directives.register("otf.merge.pairs",function(v) merge_pairs=v end)
directives.register("otf.merge.singles",function(v) merge_singles=v end)
directives.register("otf.merge.substitutions",function(v) merge_substitutions=v end)
directives.register("otf.merge.alternates",function(v) merge_alternates=v end)
directives.register("otf.merge.multiples",function(v) merge_multiples=v end)
directives.register("otf.merge.ligatures",function(v) merge_ligatures=v end)
directives.register("otf.merge.cursives",function(v) merge_cursives=v end)
directives.register("otf.merge.marks",function(v) merge_marks=v end)
local function checkpairs(lookup)
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local kerned=0
 local function onlykerns(step)
  local coverage=step.coverage
  for g1,d1 in next,coverage do
   for g2,d2 in next,d1 do
    if d2[2] then
     return false
    else
     local v=d2[1]
     if v==true then
     elseif v and (v[1]~=0 or v[2]~=0 or v[4]~=0) then
      return false
     end
    end
   end
  end
  return coverage
 end
 for i=1,nofsteps do
  local step=steps[i]
  if step.format=="pair" then
   local coverage=onlykerns(step)
   if coverage then
    if trace_optimizations then
     report_optimizations("turning pairs of step %a of %a lookup %a into kerns",i,lookup.type,lookup.name)
    end
    for g1,d1 in next,coverage do
     local d={}
     for g2,d2 in next,d1 do
      local v=d2[1]
      if v==true then
      elseif v then
       d[g2]=v[3] 
      end
     end
     coverage[g1]=d
    end
    step.format="move"
    kerned=kerned+1
   end
  end
 end
 return kerned
end
local function strippairs(lookup)
 local steps=lookup.steps
 local nofsteps=lookup.nofsteps
 local stripped=0
 for i=1,nofsteps do
  local step=steps[i]
  if step.format=="pair" then
   local coverage=step.coverage
   for g1,d1 in next,coverage do
    for g2,d2 in next,d1 do
     if d2[2] then
     elseif d2[1]==true then
      d1[g2]=nil
      stripped=stripped+1
     end
    end
   end
  end
 end
 return stripped
end
function readers.compact(data)
 if not data or data.compacted then
  return
 else
  data.compacted=true
 end
 local resources=data.resources
 local stripped=0
 local merged=0
 local kerned=0
 local allsteps=0
 local function compact(what)
  local lookups=resources[what]
  if lookups then
   for i=1,#lookups do
    local lookup=lookups[i]
    local nofsteps=lookup.nofsteps
    local kind=lookup.type
    allsteps=allsteps+nofsteps
    if nofsteps>1 then
     local merg=merged
     if kind=="gsub_single" then
      if merge_substitutions then
       merged=merged+mergesteps_1(lookup)
      end
     elseif kind=="gsub_alternate" then
      if merge_alternates then
       merged=merged+mergesteps_1(lookup)
      end
     elseif kind=="gsub_multiple" then
      if merge_multiples then
       merged=merged+mergesteps_1(lookup)
      end
     elseif kind=="gsub_ligature" then
      if merge_ligatures then
       merged=merged+mergesteps_4(lookup)
      end
     elseif kind=="gpos_single" then
      if merge_singles then
       merged=merged+mergesteps_1(lookup,true)
      end
      if compact_singles then
       kerned=kerned+checkkerns(lookup)
      end
     elseif kind=="gpos_pair" then
      if strip_pairs then
       stripped=stripped+strippairs(lookup) 
      end
      if merge_pairs then
       merged=merged+mergesteps_2(lookup)
      end
      if compact_pairs then
       kerned=kerned+checkpairs(lookup)
      end
     elseif kind=="gpos_cursive" then
      if merge_cursives then
       merged=merged+mergesteps_5(lookup)
      end
     elseif kind=="gpos_mark2mark" or kind=="gpos_mark2base" or kind=="gpos_mark2ligature" then
      if merge_marks then
       merged=merged+mergesteps_3(lookup)
      end
     end
     if merg~=merged then
      lookup.merged=true
     end
    elseif nofsteps==1 then
     local kern=kerned
     if kind=="gpos_single" then
      if compact_singles then
       kerned=kerned+checkkerns(lookup)
      end
     elseif kind=="gpos_pair" then
      if compact_pairs then
       kerned=kerned+checkpairs(lookup)
      end
     end
     if kern~=kerned then
     end
    end
   end
  elseif trace_optimizations then
   report_optimizations("no lookups in %a",what)
  end
 end
 compact("sequences")
 compact("sublookups")
 if trace_optimizations then
  if stripped>0 then
   report_optimizations("%i zero positions stripped before merging",stripped)
  end
  if merged>0 then
   report_optimizations("%i steps of %i removed due to merging",merged,allsteps)
  end
  if kerned>0 then
   report_optimizations("%i steps of %i steps turned from pairs into kerns",kerned,allsteps)
  end
 end
end
if CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 then
 local done=0
 local function condense_1(k,v,t)
  if type(v)=="table" then
   local u=false
   local l=false
   for k,v in next,v do
    if k=="ligature" then
     l=v
     if u then
      break
     end
    elseif u then
     break
    else
     u=true
    end
   end
   if l and not u then
    t[k]=l
    done=done+1
   end
   if u then
    for k,vv in next,v do
     if k~="ligature" then
      condense_1(k,vv,v)
     end
    end
   end
  end
 end
 local function condensesteps_1(lookup)
  done=0
  if lookup.type=="gsub_ligature" then
   local steps=lookup.steps
   if steps then
    for i=1,#steps do
     local step=steps[i]
     local coverage=step.coverage
     if coverage then
      for k,v in next,coverage do
       if condense_1(k,v,coverage) then
        coverage[k]=v.ligature
        done=done+1
       end
      end
     end
    end
   end
  end
  return done
 end
 function readers.condense(data)
  if not data or data.condensed then
   return
  else
   data.condensed=true
  end
  local resources=data.resources
  local condensed=0
  local function condense(what)
   local lookups=resources[what]
   if lookups then
    for i=1,#lookups do
     condensed=condensed+condensesteps_1(lookups[i])
    end
   elseif trace_optimizations then
    report_optimizations("no lookups in %a",what)
   end
  end
  condense("sequences")
  condense("sublookups")
  if trace_optimizations then
   if condensed>0 then
    report_optimizations("%i ligatures condensed",condensed)
   end
  end
 end
end
local function mergesteps(t,k)
 if k=="merged" then
  local merged={}
  for i=1,#t do
   local step=t[i]
   local coverage=step.coverage
   for k in next,coverage do
    local m=merged[k]
    if m then
     m[2]=i
    else
     merged[k]={ i,i }
    end
   end
  end
  t.merged=merged
  return merged
 end
end
local function checkmerge(sequence)
 local steps=sequence.steps
 if steps then
  setmetatableindex(steps,mergesteps)
 end
end
local function checkflags(sequence,resources)
 if not sequence.skiphash then
  local flags=sequence.flags
  if flags then
   local skipmark=flags[1]
   local skipligature=flags[2]
   local skipbase=flags[3]
   local markclass=sequence.markclass
   local skipsome=skipmark or skipligature or skipbase or markclass or false
   if skipsome then
    sequence.skiphash=setmetatableindex(function(t,k)
     local c=resources.classes[k] 
     local v=c==skipmark
         or (markclass and c=="mark" and not markclass[k])
         or c==skipligature
         or c==skipbase
         or false
     t[k]=v
     return v
    end)
   else
    sequence.skiphash=false
   end
  else
   sequence.skiphash=false
  end
 end
end
local function checksteps(sequence)
 local steps=sequence.steps
 if steps then
  for i=1,#steps do
   steps[i].index=i
  end
 end
end
if fonts.helpers then
 fonts.helpers.checkmerge=checkmerge
 fonts.helpers.checkflags=checkflags
 fonts.helpers.checksteps=checksteps 
end
function readers.expand(data)
 if not data or data.expanded then
  return
 else
  data.expanded=true
 end
 local resources=data.resources
 local sublookups=resources.sublookups
 local sequences=resources.sequences 
 local markclasses=resources.markclasses
 local descriptions=data.descriptions
 if descriptions then
  local defaultwidth=resources.defaultwidth  or 0
  local defaultheight=resources.defaultheight or 0
  local defaultdepth=resources.defaultdepth  or 0
  local basename=trace_markwidth and file.basename(resources.filename)
  for u,d in next,descriptions do
   local bb=d.boundingbox
   local wd=d.width
   if not wd then
    d.width=defaultwidth
   elseif trace_markwidth and wd~=0 and d.class=="mark" then
    report_markwidth("mark %a with width %b found in %a",d.name or "<noname>",wd,basename)
   end
   if bb then
    local ht=bb[4]
    local dp=-bb[2]
    if ht==0 or ht<0 then
    else
     d.height=ht
    end
    if dp==0 or dp<0 then
    else
     d.depth=dp
    end
   end
  end
 end
 local function expandlookups(sequences,whatever)
  if sequences then
   for i=1,#sequences do
    local sequence=sequences[i]
    local steps=sequence.steps
    if steps then
     local nofsteps=sequence.nofsteps
     local kind=sequence.type
     local markclass=sequence.markclass
     if markclass then
      if not markclasses then
       report_warning("missing markclasses")
       sequence.markclass=false
      else
       sequence.markclass=markclasses[markclass]
      end
     end
     for i=1,nofsteps do
      local step=steps[i]
      local baseclasses=step.baseclasses
      if baseclasses then
       local coverage=step.coverage
       for k,v in next,coverage do
        v[1]=baseclasses[v[1]] 
       end
      elseif kind=="gpos_cursive" then
       local coverage=step.coverage
       for k,v in next,coverage do
        v[1]=coverage 
       end
      end
      local rules=step.rules
      if rules then
       local rulehash={ n=0 } 
       local rulesize=0
       local coverage={}
       local lookuptype=sequence.type
       local nofrules=#rules
       step.coverage=coverage 
       for currentrule=1,nofrules do
        local rule=rules[currentrule]
        local current=rule.current
        local before=rule.before
        local after=rule.after
        local replacements=rule.replacements or false
        local sequence={}
        local nofsequences=0
        if before then
         for n=1,#before do
          nofsequences=nofsequences+1
          sequence[nofsequences]=before[n]
         end
        end
        local start=nofsequences+1
        for n=1,#current do
         nofsequences=nofsequences+1
         sequence[nofsequences]=current[n]
        end
        local stop=nofsequences
        if after then
         for n=1,#after do
          nofsequences=nofsequences+1
          sequence[nofsequences]=after[n]
         end
        end
        local lookups=rule.lookups or false
        local subtype=nil
        if lookups then
         for i=1,#lookups do
          local lookups=lookups[i]
          if lookups then
           for k,v in next,lookups do 
            local lookup=sublookups[v]
if not lookup and whatever then
 lookup=whatever[v]
end
            if lookup then
             lookups[k]=lookup
             if not subtype then
              subtype=lookup.type
             end
            else
            end
           end
          end
         end
        end
        if sequence[1] then 
         sequence.n=#sequence 
         local ruledata={
          currentrule,
          lookuptype,
          sequence,
          start,
          stop,
          lookups,
          replacements,
          subtype,
         }
         rulesize=rulesize+1
         rulehash[rulesize]=ruledata
         rulehash.n=rulesize
         if true then 
          for unic in next,sequence[start] do
           local cu=coverage[unic]
           if cu then
            local n=#cu+1
            cu[n]=ruledata
            cu.n=n
           else
            coverage[unic]={ ruledata,n=1 }
           end
          end
         else
          for unic in next,sequence[start] do
           local cu=coverage[unic]
           if cu then
           else
            coverage[unic]=rulehash
           end
          end
         end
        end
       end
      end
     end
     checkmerge(sequence)
     checkflags(sequence,resources)
     checksteps(sequence)
    end
   end
  end
 end
 expandlookups(sequences)
 expandlookups(sublookups,sequences)
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oup”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otl” 67078f58bc1a612e4646523538a4e3eb] ---

if not modules then modules={} end modules ['font-otl']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files",
}
local lower=string.lower
local type,next,tonumber,tostring,unpack=type,next,tonumber,tostring,unpack
local abs=math.abs
local derivetable,sortedhash=table.derive,table.sortedhash
local formatters=string.formatters
local setmetatableindex=table.setmetatableindex
local allocate=utilities.storage.allocate
local registertracker=trackers.register
local registerdirective=directives.register
local starttiming=statistics.starttiming
local stoptiming=statistics.stoptiming
local elapsedtime=statistics.elapsedtime
local findbinfile=resolvers.findbinfile
local trace_loading=false  registertracker("otf.loading",function(v) trace_loading=v end)
local trace_features=false  registertracker("otf.features",function(v) trace_features=v end)
local trace_defining=false  registertracker("fonts.defining",function(v) trace_defining=v end)
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
otf.version=3.119 
otf.cache=containers.define("fonts","otl",otf.version,true)
otf.svgcache=containers.define("fonts","svg",otf.version,true)
otf.pngcache=containers.define("fonts","png",otf.version,true)
otf.pdfcache=containers.define("fonts","pdf",otf.version,true)
otf.mpscache=containers.define("fonts","mps",otf.version,true)
otf.svgenabled=false
otf.pngenabled=false
local otfreaders=otf.readers
local hashes=fonts.hashes
local definers=fonts.definers
local readers=fonts.readers
local constructors=fonts.constructors
local otffeatures=constructors.features.otf
local registerotffeature=otffeatures.register
local otfenhancers=constructors.enhancers.otf
local registerotfenhancer=otfenhancers.register
local forceload=false
local cleanup=0  
local syncspace=true
local forcenotdef=false
local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000 
local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes
local wildcard="*"
local default="dflt"
local formats=fonts.formats
formats.otf="opentype"
formats.ttf="truetype"
formats.ttc="truetype"
registerdirective("fonts.otf.loader.cleanup",function(v) cleanup=tonumber(v) or (v and 1) or 0 end)
registerdirective("fonts.otf.loader.force",function(v) forceload=v end)
registerdirective("fonts.otf.loader.syncspace",function(v) syncspace=v end)
registerdirective("fonts.otf.loader.forcenotdef",function(v) forcenotdef=v end)
registerotfenhancer("check extra features",function() end)
local checkmemory=utilities.lua and utilities.lua.checkmemory
local threshold=100 
local tracememory=false
registertracker("fonts.otf.loader.memory",function(v) tracememory=v end)
if not checkmemory then 
 local collectgarbage=collectgarbage
 checkmemory=function(previous,threshold) 
  local current=collectgarbage("count")
  if previous then
   local checked=(threshold or 64)*1024
   if current-previous>checked then
    collectgarbage("collect")
    current=collectgarbage("count")
   end
  end
  return current
 end
end
function otf.load(filename,sub,instance)
 local base=file.basename(file.removesuffix(filename))
 local name=file.removesuffix(base) 
 local attr=lfs.attributes(filename)
 local size=attr and attr.size or 0
 local time=attr and attr.modification or 0
 if sub=="" then
  sub=false
 end
 local hash=name
 if sub then
  hash=hash.."-"..sub
 end
 if instance then
  hash=hash.."-"..instance
 end
 hash=containers.cleanname(hash)
 local data=containers.read(otf.cache,hash)
 local reload=not data or data.size~=size or data.time~=time or data.tableversion~=otfreaders.tableversion
 if forceload then
  report_otf("forced reload of %a due to hard coded flag",filename)
  reload=true
 end
 if reload then
  report_otf("loading %a, hash %a",filename,hash)
  starttiming(otfreaders,true)
  data=otfreaders.loadfont(filename,sub or 1,instance) 
  if data then
   local used=checkmemory()
   local resources=data.resources
   local svgshapes=resources.svgshapes
   local pngshapes=resources.pngshapes
   if cleanup==0 then
    checkmemory(used,threshold,tracememory)
   end
   if svgshapes then
    resources.svgshapes=nil
    if otf.svgenabled then
     local timestamp=os.date()
     containers.write(otf.svgcache,hash,{
      svgshapes=svgshapes,
      timestamp=timestamp,
     })
     data.properties.svg={
      hash=hash,
      timestamp=timestamp,
     }
    end
    if cleanup>1 then
     collectgarbage("collect")
    else
     checkmemory(used,threshold,tracememory)
    end
   end
   if pngshapes then
    resources.pngshapes=nil
    if otf.pngenabled then
     local timestamp=os.date()
     containers.write(otf.pngcache,hash,{
      pngshapes=pngshapes,
      timestamp=timestamp,
     })
     data.properties.png={
      hash=hash,
      timestamp=timestamp,
     }
    end
    if cleanup>1 then
     collectgarbage("collect")
    else
     checkmemory(used,threshold,tracememory)
    end
   end
   otfreaders.compact(data)
   if cleanup==0 then
    checkmemory(used,threshold,tracememory)
   end
   otfreaders.rehash(data,"unicodes")
   otfreaders.addunicodetable(data)
   otfreaders.extend(data)
   if cleanup==0 then
    checkmemory(used,threshold,tracememory)
   end
   if context then
    otfreaders.condense(data)
   end
   otfreaders.pack(data)
   report_otf("loading done")
   report_otf("saving %a in cache",filename)
   data=containers.write(otf.cache,hash,data)
   if cleanup>1 then
    collectgarbage("collect")
   else
    checkmemory(used,threshold,tracememory)
   end
   stoptiming(otfreaders)
   if elapsedtime then
    report_otf("loading, optimizing, packing and caching time %s",elapsedtime(otfreaders))
   end
   if cleanup>3 then
    collectgarbage("collect")
   else
    checkmemory(used,threshold,tracememory)
   end
   data=containers.read(otf.cache,hash) 
   if cleanup>2 then
    collectgarbage("collect")
   else
    checkmemory(used,threshold,tracememory)
   end
  else
   stoptiming(otfreaders)
   data=nil
   report_otf("loading failed due to read error")
  end
 end
 if data then
  if trace_defining then
   report_otf("loading from cache using hash %a",hash)
  end
  otfreaders.unpack(data)
  otfreaders.expand(data) 
  otfreaders.addunicodetable(data)
  otfenhancers.apply(data,filename,data)
  if applyruntimefixes then
   applyruntimefixes(filename,data) 
  end
  data.metadata.math=data.resources.mathconstants
  local classes=data.resources.classes
  if not classes then
   local descriptions=data.descriptions
   classes=setmetatableindex(function(t,k)
    local d=descriptions[k]
    local v=(d and d.class or "base") or false
    t[k]=v
    return v
   end)
   data.resources.classes=classes
  end
 end
 return data
end
function otf.setfeatures(tfmdata,features)
 local okay=constructors.initializefeatures("otf",tfmdata,features,trace_features,report_otf)
 if okay then
  return constructors.collectprocessors("otf",tfmdata,features,trace_features,report_otf)
 else
  return {} 
 end
end
local function copytotfm(data,cache_id)
 if data then
  local metadata=data.metadata
  local properties=derivetable(data.properties)
  local descriptions=derivetable(data.descriptions)
  local goodies=derivetable(data.goodies)
  local characters={} 
  local parameters={}
  local mathparameters={}
  local resources=data.resources
  local unicodes=resources.unicodes
  local spaceunits=500
  local spacer="space"
  local designsize=metadata.designsize or 100
  local minsize=metadata.minsize or designsize
  local maxsize=metadata.maxsize or designsize
  local mathspecs=metadata.math
  if designsize==0 then
   designsize=100
   minsize=100
   maxsize=100
  end
  if mathspecs then
   for name,value in next,mathspecs do
    mathparameters[name]=value
   end
  end
  for unicode in next,data.descriptions do 
   characters[unicode]={}
  end
  if mathspecs then
   for unicode,character in next,characters do
    local d=descriptions[unicode] 
    local m=d.math
    if m then
     local italic=m.italic
     local vitalic=m.vitalic
     local variants=m.hvariants
     local parts=m.hparts
     if variants then
      local c=character
      for i=1,#variants do
       local un=variants[i]
       c.next=un
       c=characters[un]
      end 
      c.horiz_variants=parts
     elseif parts then
      character.horiz_variants=parts
      italic=m.hitalic
     end
     local variants=m.vvariants
     local parts=m.vparts
     if variants then
      local c=character
      for i=1,#variants do
       local un=variants[i]
       c.next=un
       c=characters[un]
      end 
      c.vert_variants=parts
     elseif parts then
      character.vert_variants=parts
     end
     if italic and italic~=0 then
      character.italic=italic
     end
     if vitalic and vitalic~=0 then
      character.vert_italic=vitalic
     end
     local accent=m.accent 
     if accent then
      character.accent=accent
     end
     local kerns=m.kerns
     if kerns then
      character.mathkerns=kerns
     end
    end
   end
  end
  local filename=constructors.checkedfilename(resources)
  local fontname=metadata.fontname
  local fullname=metadata.fullname or fontname
  local psname=fontname or fullname
  local subfont=metadata.subfontindex
  local units=metadata.units or 1000
  if units==0 then 
   units=1000 
   metadata.units=1000
   report_otf("changing %a units to %a",0,units)
  end
  local monospaced=metadata.monospaced
  local charwidth=metadata.averagewidth 
  local charxheight=metadata.xheight 
  local italicangle=metadata.italicangle
  local hasitalics=metadata.hasitalics
  properties.monospaced=monospaced
  properties.hasitalics=hasitalics
  parameters.italicangle=italicangle
  parameters.charwidth=charwidth
  parameters.charxheight=charxheight
  local space=0x0020
  local emdash=0x2014
  if monospaced then
   if descriptions[space] then
    spaceunits,spacer=descriptions[space].width,"space"
   end
   if not spaceunits and descriptions[emdash] then
    spaceunits,spacer=descriptions[emdash].width,"emdash"
   end
   if not spaceunits and charwidth then
    spaceunits,spacer=charwidth,"charwidth"
   end
  else
   if descriptions[space] then
    spaceunits,spacer=descriptions[space].width,"space"
   end
   if not spaceunits and descriptions[emdash] then
    spaceunits,spacer=descriptions[emdash].width/2,"emdash/2"
   end
   if not spaceunits and charwidth then
    spaceunits,spacer=charwidth,"charwidth"
   end
  end
  spaceunits=tonumber(spaceunits) or units/2
  parameters.slant=0
  parameters.space=spaceunits   
  parameters.space_stretch=1*units/2   
  parameters.space_shrink=1*units/3   
  parameters.x_height=2*units/5   
  parameters.quad=units    
  if spaceunits<2*units/5 then
  end
  if italicangle and italicangle~=0 then
   parameters.italicangle=italicangle
   parameters.italicfactor=math.cos(math.rad(90+italicangle))
   parameters.slant=- math.tan(italicangle*math.pi/180)
  end
  if monospaced then
   parameters.space_stretch=0
   parameters.space_shrink=0
  elseif syncspace then 
   parameters.space_stretch=spaceunits/2
   parameters.space_shrink=spaceunits/3
  end
  parameters.extra_space=parameters.space_shrink 
  if charxheight then
   parameters.x_height=charxheight
  else
   local x=0x0078
   if x then
    local x=descriptions[x]
    if x then
     parameters.x_height=x.height
    end
   end
  end
  parameters.designsize=(designsize/10)*65536
  parameters.minsize=(minsize/10)*65536
  parameters.maxsize=(maxsize/10)*65536
  parameters.ascender=abs(metadata.ascender  or 0)
  parameters.descender=abs(metadata.descender or 0)
  parameters.units=units
  parameters.vheight=metadata.defaultvheight
  properties.space=spacer
  properties.format=data.format or formats.otf
  properties.filename=filename
  properties.fontname=fontname
  properties.fullname=fullname
  properties.psname=psname
  properties.name=filename or fullname
  properties.subfont=subfont
if not CONTEXTLMTXMODE or CONTEXTLMTXMODE==0 then
 properties.encodingbytes=2
elseif CONTEXTLMTXMODE then
 local duplicates=resources and resources.duplicates
 if duplicates then
  local maxindex=data.nofglyphs or metadata.nofglyphs
  if maxindex then
   for u,d in sortedhash(duplicates) do
    local du=descriptions[u]
    if du then
     for uu in sortedhash(d) do
      maxindex=maxindex+1
      descriptions[uu].dupindex=du.index
      descriptions[uu].index=maxindex
     end
    else
    end
   end
  end
 end
end
  properties.private=properties.private or data.private or privateoffset
  return {
   characters=characters,
   descriptions=descriptions,
   parameters=parameters,
   mathparameters=mathparameters,
   resources=resources,
   properties=properties,
   goodies=goodies,
  }
 end
end
local converters={
 woff={
  cachename="webfonts",
  action=otf.readers.woff2otf,
 }
}
local function checkconversion(specification)
 local filename=specification.filename
 local converter=converters[lower(file.suffix(filename))]
 if converter then
  local base=file.basename(filename)
  local name=file.removesuffix(base)
  local attr=lfs.attributes(filename)
  local size=attr and attr.size or 0
  local time=attr and attr.modification or 0
  if size>0 then
   local cleanname=containers.cleanname(name)
   local cachename=caches.setfirstwritablefile(cleanname,converter.cachename)
   if not io.exists(cachename) or (time~=lfs.attributes(cachename).modification) then
    report_otf("caching font %a in %a",filename,cachename)
    converter.action(filename,cachename) 
    lfs.touch(cachename,time,time)
   end
   specification.filename=cachename
  end
 end
end
local function otftotfm(specification)
 local cache_id=specification.hash
 local tfmdata=containers.read(constructors.cache,cache_id)
 if not tfmdata then
  checkconversion(specification) 
  local name=specification.name
  local sub=specification.sub
  local subindex=specification.subindex
  local filename=specification.filename
  local features=specification.features.normal
  local instance=specification.instance or (features and features.axis)
  local rawdata=otf.load(filename,sub,instance)
  if rawdata and next(rawdata) then
   local descriptions=rawdata.descriptions
   rawdata.lookuphash={} 
   tfmdata=copytotfm(rawdata,cache_id)
   if tfmdata and next(tfmdata) then
    local features=constructors.checkedfeatures("otf",features)
    local shared=tfmdata.shared
    if not shared then
     shared={}
     tfmdata.shared=shared
    end
    shared.rawdata=rawdata
    shared.dynamics={}
    tfmdata.changed={}
    shared.features=features
    shared.processes=otf.setfeatures(tfmdata,features)
   end
  end
  containers.write(constructors.cache,cache_id,tfmdata)
 end
 return tfmdata
end
local function read_from_otf(specification)
 local tfmdata=otftotfm(specification)
 if tfmdata then
  tfmdata.properties.name=specification.name
  tfmdata.properties.sub=specification.sub
  tfmdata.properties.id=specification.id
  tfmdata=constructors.scale(tfmdata,specification)
  local allfeatures=tfmdata.shared.features or specification.features.normal
  constructors.applymanipulators("otf",tfmdata,allfeatures,trace_features,report_otf)
  constructors.setname(tfmdata,specification) 
  fonts.loggers.register(tfmdata,file.suffix(specification.filename),specification)
 end
 return tfmdata
end
local function checkmathsize(tfmdata,mathsize)
 local mathdata=tfmdata.shared.rawdata.metadata.math
 local mathsize=tonumber(mathsize)
 if mathdata then 
  local parameters=tfmdata.parameters
  parameters.scriptpercentage=mathdata.ScriptPercentScaleDown
  parameters.scriptscriptpercentage=mathdata.ScriptScriptPercentScaleDown
  parameters.mathsize=mathsize 
 end
end
registerotffeature {
 name="mathsize",
 description="apply mathsize specified in the font",
 initializers={
  base=checkmathsize,
  node=checkmathsize,
 }
}
function otf.collectlookups(rawdata,kind,script,language)
 if not kind then
  return
 end
 if not script then
  script=default
 end
 if not language then
  language=default
 end
 local lookupcache=rawdata.lookupcache
 if not lookupcache then
  lookupcache={}
  rawdata.lookupcache=lookupcache
 end
 local kindlookup=lookupcache[kind]
 if not kindlookup then
  kindlookup={}
  lookupcache[kind]=kindlookup
 end
 local scriptlookup=kindlookup[script]
 if not scriptlookup then
  scriptlookup={}
  kindlookup[script]=scriptlookup
 end
 local languagelookup=scriptlookup[language]
 if not languagelookup then
  local sequences=rawdata.resources.sequences
  local featuremap={}
  local featurelist={}
  if sequences then
   for s=1,#sequences do
    local sequence=sequences[s]
    local features=sequence.features
    if features then
     features=features[kind]
     if features then
      features=features[script] or features[wildcard]
      if features then
       features=features[language] or features[wildcard]
       if features then
        if not featuremap[sequence] then
         featuremap[sequence]=true
         featurelist[#featurelist+1]=sequence
        end
       end
      end
     end
    end
   end
   if #featurelist==0 then
    featuremap,featurelist=false,false
   end
  else
   featuremap,featurelist=false,false
  end
  languagelookup={ featuremap,featurelist }
  scriptlookup[language]=languagelookup
 end
 return unpack(languagelookup)
end
local function getgsub(tfmdata,k,kind,value)
 local shared=tfmdata.shared
 local rawdata=shared and shared.rawdata
 if rawdata then
  local sequences=rawdata.resources.sequences
  if sequences then
   local properties=tfmdata.properties
   local validlookups,lookuplist=otf.collectlookups(rawdata,kind,properties.script,properties.language)
   if validlookups then
    for i=1,#lookuplist do
     local lookup=lookuplist[i]
     local steps=lookup.steps
     local nofsteps=lookup.nofsteps
     for i=1,nofsteps do
      local coverage=steps[i].coverage
      if coverage then
       local found=coverage[k]
       if found then
        return found,lookup.type
       end
      end
     end
    end
   end
  end
 end
end
otf.getgsub=getgsub 
function otf.getsubstitution(tfmdata,k,kind,value)
 local found,kind=getgsub(tfmdata,k,kind,value)
 if not found then
 elseif kind=="gsub_single" then
  return found
 elseif kind=="gsub_alternate" then
  local choice=tonumber(value) or 1 
  return found[choice] or found[1] or k
 end
 return k
end
otf.getalternate=otf.getsubstitution
function otf.getmultiple(tfmdata,k,kind)
 local found,kind=getgsub(tfmdata,k,kind)
 if found and kind=="gsub_multiple" then
  return found
 end
 return { k }
end
function otf.getkern(tfmdata,left,right,kind)
 local kerns=getgsub(tfmdata,left,kind or "kern",true) 
 if kerns then
  local found=kerns[right]
  local kind=type(found)
  if kind=="table" then
   found=found[1][3] 
  elseif kind~="number" then
   found=false
  end
  if found then
   return found*tfmdata.parameters.factor
  end
 end
 return 0
end
local function check_otf(forced,specification,suffix)
 local name=specification.name
 if forced then
  name=specification.forcedname 
 end
 local fullname=findbinfile(name,suffix) or ""
 if fullname=="" then
  fullname=fonts.names.getfilename(name,suffix) or ""
 end
 if fullname~="" and not fonts.names.ignoredfile(fullname) then
  specification.filename=fullname
  return read_from_otf(specification)
 end
end
local function opentypereader(specification,suffix)
 local forced=specification.forced or ""
 if formats[forced] then
  return check_otf(true,specification,forced)
 else
  return check_otf(false,specification,suffix)
 end
end
readers.opentype=opentypereader 
function readers.otf(specification) return opentypereader(specification,"otf") end
function readers.ttf(specification) return opentypereader(specification,"ttf") end
function readers.ttc(specification) return opentypereader(specification,"ttf") end
function readers.woff(specification)
 checkconversion(specification)
 opentypereader(specification,"")
end
function otf.scriptandlanguage(tfmdata,attr)
 local properties=tfmdata.properties
 return properties.script or "dflt",properties.language or "dflt"
end
local function justset(coverage,unicode,replacement)
 coverage[unicode]=replacement
end
otf.coverup={
 stepkey="steps",
 actions={
  chainsubstitution=justset,
  chainposition=justset,
  substitution=justset,
  alternate=justset,
  multiple=justset,
  kern=justset,
  pair=justset,
  single=justset,
  ligature=function(coverage,unicode,ligature)
   local first=ligature[1]
   local tree=coverage[first]
   if not tree then
    tree={}
    coverage[first]=tree
   end
   for i=2,#ligature do
    local l=ligature[i]
    local t=tree[l]
    if not t then
     t={}
     tree[l]=t
    end
    tree=t
   end
   tree.ligature=unicode
  end,
 },
 register=function(coverage,featuretype,format)
  return {
   format=format,
   coverage=coverage,
  }
 end
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otl”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oto” 9febc4d75d17a543cd73fb17918f7307] ---

if not modules then modules={} end modules ['font-oto']={ 
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local concat,unpack=table.concat,table.unpack
local insert,remove=table.insert,table.remove
local format,gmatch,gsub,find,match,lower,strip=string.format,string.gmatch,string.gsub,string.find,string.match,string.lower,string.strip
local type,next,tonumber,tostring=type,next,tonumber,tostring
local trace_baseinit=false  trackers.register("otf.baseinit",function(v) trace_baseinit=v end)
local trace_singles=false  trackers.register("otf.singles",function(v) trace_singles=v end)
local trace_multiples=false  trackers.register("otf.multiples",function(v) trace_multiples=v end)
local trace_alternatives=false  trackers.register("otf.alternatives",function(v) trace_alternatives=v end)
local trace_ligatures=false  trackers.register("otf.ligatures",function(v) trace_ligatures=v end)
local trace_kerns=false  trackers.register("otf.kerns",function(v) trace_kerns=v end)
local trace_preparing=false  trackers.register("otf.preparing",function(v) trace_preparing=v end)
local report_prepare=logs.reporter("fonts","otf prepare")
local fonts=fonts
local otf=fonts.handlers.otf
local otffeatures=otf.features
local registerotffeature=otffeatures.register
otf.defaultbasealternate="none" 
local getprivate=fonts.constructors.getprivate
local wildcard="*"
local default="dflt"
local formatters=string.formatters
local f_unicode=formatters["%U"]
local f_uniname=formatters["%U (%s)"]
local f_unilist=formatters["% t (% t)"]
local function gref(descriptions,n)
 if type(n)=="number" then
  local name=descriptions[n].name
  if name then
   return f_uniname(n,name)
  else
   return f_unicode(n)
  end
 elseif n then
  local num={}
  local nam={}
  local j=0
  for i=1,#n do
   local ni=n[i]
   if tonumber(ni) then 
    j=j+1
    local di=descriptions[ni]
    num[j]=f_unicode(ni)
    nam[j]=di and di.name or "-"
   end
  end
  return f_unilist(num,nam)
 else
  return "<error in base mode tracing>"
 end
end
local function cref(feature,sequence)
 return formatters["feature %a, type %a, (chain) lookup %a"](feature,sequence.type,sequence.name)
end
local function report_substitution(feature,sequence,descriptions,unicode,substitution)
 if unicode==substitution then
  report_prepare("%s: base substitution %s maps onto itself",
   cref(feature,sequence),
   gref(descriptions,unicode))
 else
  report_prepare("%s: base substitution %s => %S",
   cref(feature,sequence),
   gref(descriptions,unicode),
   gref(descriptions,substitution))
 end
end
local function report_alternate(feature,sequence,descriptions,unicode,replacement,value,comment)
 if unicode==replacement then
  report_prepare("%s: base alternate %s maps onto itself",
   cref(feature,sequence),
   gref(descriptions,unicode))
 else
  report_prepare("%s: base alternate %s => %s (%S => %S)",
   cref(feature,sequence),
   gref(descriptions,unicode),
   replacement and gref(descriptions,replacement),
   value,
   comment)
 end
end
local function report_ligature(feature,sequence,descriptions,unicode,ligature)
 report_prepare("%s: base ligature %s => %S",
  cref(feature,sequence),
  gref(descriptions,ligature),
  gref(descriptions,unicode))
end
local function report_kern(feature,sequence,descriptions,unicode,otherunicode,value)
 report_prepare("%s: base kern %s + %s => %S",
  cref(feature,sequence),
  gref(descriptions,unicode),
  gref(descriptions,otherunicode),
  value)
end
local basehash,basehashes,applied={},1,{}
local function registerbasehash(tfmdata)
 local properties=tfmdata.properties
 local hash=concat(applied," ")
 local base=basehash[hash]
 if not base then
  basehashes=basehashes+1
  base=basehashes
  basehash[hash]=base
 end
 properties.basehash=base
 properties.fullname=(properties.fullname or properties.name).."-"..base
 applied={}
end
local function registerbasefeature(feature,value)
 applied[#applied+1]=feature.."="..tostring(value)
end
local function makefake(tfmdata,name,present)
 local private=getprivate(tfmdata)
 local character={ intermediate=true,ligatures={} }
 tfmdata.resources.unicodes[name]=private
 tfmdata.characters[private]=character
 tfmdata.descriptions[private]={ name=name }
 present[name]=private
 return character
end
local function make_1(present,tree,name)
 if tonumber(tree) then
  present[name]=v
 else
  for k,v in next,tree do
   if k=="ligature" then
    present[name]=v
   else
    make_1(present,v,name.."_"..k)
   end
  end
 end
end
local function make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
 local character=characters[preceding]
 if not character then
  if trace_baseinit then
   report_prepare("weird ligature in lookup %a, current %C, preceding %C",sequence.name,v,preceding)
  end
  character=makefake(tfmdata,name,present)
 end
 local ligatures=character.ligatures
 if ligatures then
  ligatures[unicode]={ char=v }
 else
  character.ligatures={ [unicode]={ char=v } }
 end
 if done then
  local d=done[name]
  if not d then
   done[name]={ "dummy",v }
  else
   d[#d+1]=v
  end
 end
end
local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done)
 if tonumber(tree) then
  make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,tree)
 else
  for k,v in next,tree do
   if k=="ligature" then
    make_3(present,tfmdata,characters,tree,name,preceding,unicode,done,v)
   else
    local code=present[name] or unicode
    local name=name.."_"..k
    make_2(present,tfmdata,characters,v,name,code,k,done)
   end
  end
 end
end
local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist)
 local characters=tfmdata.characters
 local descriptions=tfmdata.descriptions
 local resources=tfmdata.resources
 local changed=tfmdata.changed
 local ligatures={}
 local alternate=tonumber(value) or true and 1
 local defaultalt=otf.defaultbasealternate
 local trace_singles=trace_baseinit and trace_singles
 local trace_alternatives=trace_baseinit and trace_alternatives
 local trace_ligatures=trace_baseinit and trace_ligatures
 if not changed then
  changed={}
  tfmdata.changed=changed
 end
 for i=1,#lookuplist do
  local sequence=lookuplist[i]
  local steps=sequence.steps
  local kind=sequence.type
  if kind=="gsub_single" then
   for i=1,#steps do
    for unicode,data in next,steps[i].coverage do
     if unicode~=data then
      changed[unicode]=data
     end
     if trace_singles then
      report_substitution(feature,sequence,descriptions,unicode,data)
     end
    end
   end
  elseif kind=="gsub_alternate" then
   for i=1,#steps do
    for unicode,data in next,steps[i].coverage do
     local replacement=data[alternate]
     if replacement then
      if unicode~=replacement then
       changed[unicode]=replacement
      end
      if trace_alternatives then
       report_alternate(feature,sequence,descriptions,unicode,replacement,value,"normal")
      end
     elseif defaultalt=="first" then
      replacement=data[1]
      if unicode~=replacement then
       changed[unicode]=replacement
      end
      if trace_alternatives then
       report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
      end
     elseif defaultalt=="last" then
      replacement=data[#data]
      if unicode~=replacement then
       changed[unicode]=replacement
      end
      if trace_alternatives then
       report_alternate(feature,sequence,descriptions,unicode,replacement,value,defaultalt)
      end
     else
      if trace_alternatives then
       report_alternate(feature,sequence,descriptions,unicode,replacement,value,"unknown")
      end
     end
    end
   end
  elseif kind=="gsub_ligature" then
   for i=1,#steps do
    for unicode,data in next,steps[i].coverage do
     ligatures[#ligatures+1]={ unicode,data,"" } 
     if trace_ligatures then
      report_ligature(feature,sequence,descriptions,unicode,data)
     end
    end
   end
  end
 end
 local nofligatures=#ligatures
 if nofligatures>0 then
  local characters=tfmdata.characters
  local present={}
  local done=trace_baseinit and trace_ligatures and {}
  for i=1,nofligatures do
   local ligature=ligatures[i]
   local unicode=ligature[1]
   local tree=ligature[2]
   make_1(present,tree,"ctx_"..unicode)
  end
  for i=1,nofligatures do
   local ligature=ligatures[i]
   local unicode=ligature[1]
   local tree=ligature[2]
   local lookupname=ligature[3]
   make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,sequence)
  end
 end
end
local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist)
 local characters=tfmdata.characters
 local descriptions=tfmdata.descriptions
 local resources=tfmdata.resources
 local properties=tfmdata.properties
 local traceindeed=trace_baseinit and trace_kerns
 for i=1,#lookuplist do
  local sequence=lookuplist[i]
  local steps=sequence.steps
  local kind=sequence.type
  local format=sequence.format
  if kind=="gpos_pair" then
   for i=1,#steps do
    local step=steps[i]
    local format=step.format
    if format=="kern" or format=="move" then
     for unicode,data in next,steps[i].coverage do
      local character=characters[unicode]
      local kerns=character.kerns
      if not kerns then
       kerns={}
       character.kerns=kerns
      end
      if traceindeed then
       for otherunicode,kern in next,data do
        if not kerns[otherunicode] and kern~=0 then
         kerns[otherunicode]=kern
         report_kern(feature,sequence,descriptions,unicode,otherunicode,kern)
        end
       end
      else
       for otherunicode,kern in next,data do
        if not kerns[otherunicode] and kern~=0 then
         kerns[otherunicode]=kern
        end
       end
      end
     end
    else
     for unicode,data in next,steps[i].coverage do
      local character=characters[unicode]
      local kerns=character.kerns
      for otherunicode,kern in next,data do
       local other=kern[2]
       if other==true or (not other and not (kerns and kerns[otherunicode])) then
        local kern=kern[1]
        if kern==true then
        elseif kern[1]~=0 or kern[2]~=0 or kern[4]~=0 then
        else
         kern=kern[3]
         if kern~=0 then
          if kerns then
           kerns[otherunicode]=kern
          else
           kerns={ [otherunicode]=kern }
           character.kerns=kerns
          end
          if traceindeed then
           report_kern(feature,sequence,descriptions,unicode,otherunicode,kern)
          end
         end
        end
       end
      end
     end
    end
   end
  end
 end
end
local function initializehashes(tfmdata)
end
local function checkmathreplacements(tfmdata,fullname,fixitalics)
 if tfmdata.mathparameters then
  local characters=tfmdata.characters
  local changed=tfmdata.changed
  if next(changed) then
   if trace_preparing or trace_baseinit then
    report_prepare("checking math replacements for %a",fullname)
   end
   for unicode,replacement in next,changed do
    local u=characters[unicode]
    local r=characters[replacement]
    if u and r then
     local n=u.next
     local v=u.vert_variants
     local h=u.horiz_variants
     if fixitalics then
      local ui=u.italic
      if ui and not r.italic then
       if trace_preparing then
        report_prepare("using %i units of italic correction from %C for %U",ui,unicode,replacement)
       end
       r.italic=ui 
      end
     end
     if n and not r.next then
      if trace_preparing then
       report_prepare("forcing %s for %C substituted by %U","incremental step",unicode,replacement)
      end
      r.next=n
     end
     if v and not r.vert_variants then
      if trace_preparing then
       report_prepare("forcing %s for %C substituted by %U","vertical variants",unicode,replacement)
      end
      r.vert_variants=v
     end
     if h and not r.horiz_variants then
      if trace_preparing then
       report_prepare("forcing %s for %C substituted by %U","horizontal variants",unicode,replacement)
      end
      r.horiz_variants=h
     end
    else
     if trace_preparing then
      report_prepare("error replacing %C by %U",unicode,replacement)
     end
    end
   end
  end
 end
end
local function featuresinitializer(tfmdata,value)
 if true then 
  local starttime=trace_preparing and os.clock()
  local features=tfmdata.shared.features
  local fullname=tfmdata.properties.fullname or "?"
  if features then
   initializehashes(tfmdata)
   local collectlookups=otf.collectlookups
   local rawdata=tfmdata.shared.rawdata
   local properties=tfmdata.properties
   local script=properties.script
   local language=properties.language
   local rawresources=rawdata.resources
   local rawfeatures=rawresources and rawresources.features
   local basesubstitutions=rawfeatures and rawfeatures.gsub
   local basepositionings=rawfeatures and rawfeatures.gpos
   local substitutionsdone=false
   local positioningsdone=false
   if basesubstitutions or basepositionings then
    local sequences=tfmdata.resources.sequences
    for s=1,#sequences do
     local sequence=sequences[s]
     local sfeatures=sequence.features
     if sfeatures then
      local order=sequence.order
      if order then
       for i=1,#order do 
        local feature=order[i]
        local value=features[feature]
        if value then
         local validlookups,lookuplist=collectlookups(rawdata,feature,script,language)
         if not validlookups then
         elseif basesubstitutions and basesubstitutions[feature] then
          if trace_preparing then
           report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value)
          end
          preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist)
          registerbasefeature(feature,value)
          substitutionsdone=true
         elseif basepositionings and basepositionings[feature] then
          if trace_preparing then
           report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value)
          end
          preparepositionings(tfmdata,feature,value,validlookups,lookuplist)
          registerbasefeature(feature,value)
          positioningsdone=true
         end
        end
       end
      end
     end
    end
   end
   if substitutionsdone then
    checkmathreplacements(tfmdata,fullname,features.fixitalics)
   end
   registerbasehash(tfmdata)
  end
  if trace_preparing then
   report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,fullname)
  end
 end
end
registerotffeature {
 name="features",
 description="features",
 default=true,
 initializers={
  base=featuresinitializer,
 }
}
otf.basemodeinitializer=featuresinitializer

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-oto”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otj” b2c165bd6771a57633f992d07384b739] ---

if not modules then modules={} end modules ['font-otj']={
 version=1.001,
 optimize=true,
 comment="companion to font-lib.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files",
}
if not nodes.properties then return end
local next,rawget,tonumber=next,rawget,tonumber
local fastcopy=table.fastcopy
local registertracker=trackers.register
local registerdirective=directives.register
local trace_injections=false  registertracker("fonts.injections",function(v) trace_injections=v end)
local trace_marks=false  registertracker("fonts.injections.marks",function(v) trace_marks=v end)
local trace_cursive=false  registertracker("fonts.injections.cursive",function(v) trace_cursive=v end)
local trace_spaces=false  registertracker("fonts.injections.spaces",function(v) trace_spaces=v end)
local report_injections=logs.reporter("fonts","injections")
local report_spaces=logs.reporter("fonts","spaces")
local attributes,nodes,node=attributes,nodes,node
fonts=fonts
local hashes=fonts.hashes
local fontdata=hashes.identifiers
local fontmarks=hashes.marks
nodes.injections=nodes.injections or {}
local injections=nodes.injections
local tracers=nodes.tracers
local setcolor=tracers and tracers.colors.set
local resetcolor=tracers and tracers.colors.reset
local nodecodes=nodes.nodecodes
local glyph_code=nodecodes.glyph
local disc_code=nodecodes.disc
local kern_code=nodecodes.kern
local glue_code=nodecodes.glue
local nuts=nodes.nuts
local nodepool=nuts.pool
local tonode=nuts.tonode
local tonut=nuts.tonut
local setfield=nuts.setfield
local getnext=nuts.getnext
local getprev=nuts.getprev
local getid=nuts.getid
local getfont=nuts.getfont
local getchar=nuts.getchar
local getoffsets=nuts.getoffsets
local getboth=nuts.getboth
local getdisc=nuts.getdisc
local setdisc=nuts.setdisc
local getreplace=nuts.getreplace
local setreplace=nuts.setreplace
local setoffsets=nuts.setoffsets
local ischar=nuts.ischar
local getkern=nuts.getkern
local setkern=nuts.setkern
local setlink=nuts.setlink
local setwidth=nuts.setwidth
local getwidth=nuts.getwidth
local nextchar=nuts.traversers.char
local nextglue=nuts.traversers.glue
local insertnodebefore=nuts.insertbefore
local insertnodeafter=nuts.insertafter
local properties=nodes.properties.data
local fontkern=nuts.pool and nuts.pool.fontkern   
local italickern=nuts.pool and nuts.pool.italickern 
local useitalickerns=false 
directives.register("fonts.injections.useitalics",function(v)
 if v then
  report_injections("using italics for space kerns (tracing only)")
 end
 useitalickerns=v
end)
if not fontkern then 
 local thekern=nuts.new("kern",0) 
 local setkern=nuts.setkern
 local copy_node=nuts.copy
 fontkern=function(k)
  local n=copy_node(thekern)
  setkern(n,k)
  return n
 end
end
if not italickern then 
 local thekern=nuts.new("kern",3) 
 local setkern=nuts.setkern
 local copy_node=nuts.copy
 italickern=function(k)
  local n=copy_node(thekern)
  setkern(n,k)
  return n
 end
end
function injections.installnewkern() end 
local nofregisteredkerns=0
local nofregisteredpositions=0
local nofregisteredmarks=0
local nofregisteredcursives=0
local keepregisteredcounts=false
function injections.keepcounts()
 keepregisteredcounts=true
end
function injections.resetcounts()
 nofregisteredkerns=0
 nofregisteredpositions=0
 nofregisteredmarks=0
 nofregisteredcursives=0
 keepregisteredcounts=false
end
function injections.reset(n)
 local p=rawget(properties,n)
 if p then
  p.injections=false 
 else
  properties[n]=false 
 end
end
function injections.copy(target,source)
 local sp=rawget(properties,source)
 if sp then
  local tp=rawget(properties,target)
  local si=sp.injections
  if si then
   si=fastcopy(si)
   if tp then
    tp.injections=si
   else
    properties[target]={
     injections=si,
    }
   end
  elseif tp then
   tp.injections=false 
  else
   properties[target]={ injections={} }
  end
 else
  local tp=rawget(properties,target)
  if tp then
   tp.injections=false 
  else
   properties[target]=false 
  end
 end
end
function injections.setligaindex(n,index) 
 local p=rawget(properties,n)
 if p then
  local i=p.injections
  if i then
   i.ligaindex=index
  else
   p.injections={
    ligaindex=index
   }
  end
 else
  properties[n]={
   injections={
    ligaindex=index
   }
  }
 end
end
function injections.getligaindex(n,default)
 local p=rawget(properties,n)
 if p then
  local i=p.injections
  if i then
   return i.ligaindex or default
  end
 end
 return default
end
function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext,r2lflag)
 local dx=factor*(exit[1]-entry[1])
 local dy=-factor*(exit[2]-entry[2])
 local ws=tfmstart.width
 local wn=tfmnext.width
 nofregisteredcursives=nofregisteredcursives+1
 if rlmode<0 then
  dx=-(dx+wn)
 else
  dx=dx-ws
 end
 if dx==0 then
  dx=0
 end
 local p=rawget(properties,start)
 if p then
  local i=p.injections
  if i then
   i.cursiveanchor=true
  else
   p.injections={
    cursiveanchor=true,
   }
  end
 else
  properties[start]={
   injections={
    cursiveanchor=true,
   },
  }
 end
 local p=rawget(properties,nxt)
 if p then
  local i=p.injections
  if i then
   i.cursivex=dx
   i.cursivey=dy
  else
   p.injections={
    cursivex=dx,
    cursivey=dy,
   }
  end
 else
  properties[nxt]={
   injections={
    cursivex=dx,
    cursivey=dy,
   },
  }
 end
 return dx,dy,nofregisteredcursives
end
function injections.setposition(kind,current,factor,rlmode,spec,injection)
 local x=factor*(spec[1] or 0)
 local y=factor*(spec[2] or 0)
 local w=factor*(spec[3] or 0)
 local h=factor*(spec[4] or 0)
 if x~=0 or w~=0 or y~=0 or h~=0 then 
  local yoffset=y-h
  local leftkern=x   
  local rightkern=w-x  
  if leftkern~=0 or rightkern~=0 or yoffset~=0 then
   nofregisteredpositions=nofregisteredpositions+1
   if rlmode and rlmode<0 then
    leftkern,rightkern=rightkern,leftkern
   end
   if not injection then
    injection="injections"
   end
   local p=rawget(properties,current)
   if p then
    local i=p[injection]
    if i then
     if leftkern~=0 then
      i.leftkern=(i.leftkern  or 0)+leftkern
     end
     if rightkern~=0 then
      i.rightkern=(i.rightkern or 0)+rightkern
     end
     if yoffset~=0 then
      i.yoffset=(i.yoffset or 0)+yoffset
     end
    elseif leftkern~=0 or rightkern~=0 then
     p[injection]={
      leftkern=leftkern,
      rightkern=rightkern,
      yoffset=yoffset,
     }
    else
     p[injection]={
      yoffset=yoffset,
     }
    end
   elseif leftkern~=0 or rightkern~=0 then
    properties[current]={
     [injection]={
      leftkern=leftkern,
      rightkern=rightkern,
      yoffset=yoffset,
     },
    }
   else
    properties[current]={
     [injection]={
      yoffset=yoffset,
     },
    }
   end
   return x,y,w,h,nofregisteredpositions
   end
 end
 return x,y,w,h 
end
function injections.setkern(current,factor,rlmode,x,injection)
 local dx=factor*x
 if dx~=0 then
  nofregisteredkerns=nofregisteredkerns+1
  local p=rawget(properties,current)
  if not injection then
   injection="injections"
  end
  if p then
   local i=p[injection]
   if i then
    i.leftkern=dx+(i.leftkern or 0)
   else
    p[injection]={
     leftkern=dx,
    }
   end
  else
   properties[current]={
    [injection]={
     leftkern=dx,
    },
   }
  end
  return dx,nofregisteredkerns
 else
  return 0,0
 end
end
function injections.setmove(current,factor,rlmode,x,injection)
 local dx=factor*x
 if dx~=0 then
  nofregisteredkerns=nofregisteredkerns+1
  local p=rawget(properties,current)
  if not injection then
   injection="injections"
  end
  if rlmode and rlmode<0 then
   if p then
    local i=p[injection]
    if i then
     i.rightkern=dx+(i.rightkern or 0)
    else
     p[injection]={
      rightkern=dx,
     }
    end
   else
    properties[current]={
     [injection]={
      rightkern=dx,
     },
    }
   end
  else
   if p then
    local i=p[injection]
    if i then
     i.leftkern=dx+(i.leftkern or 0)
    else
     p[injection]={
      leftkern=dx,
     }
    end
   else
    properties[current]={
     [injection]={
      leftkern=dx,
     },
    }
   end
  end
  return dx,nofregisteredkerns
 else
  return 0,0
 end
end
function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmark) 
 local dx=factor*(ba[1]-ma[1])
 local dy=factor*(ba[2]-ma[2])
 nofregisteredmarks=nofregisteredmarks+1
 if rlmode>=0 then
  dx=tfmbase.width-dx 
 end
 local p=rawget(properties,start)
 if p then
  local i=p.injections
  if i then
   if i.markmark then
   else
    i.markx=dx
    i.marky=dy
    i.markdir=rlmode or 0
    i.markbase=nofregisteredmarks
    i.markbasenode=base
    i.markmark=mkmk
    i.checkmark=checkmark
   end
  else
   p.injections={
    markx=dx,
    marky=dy,
    markdir=rlmode or 0,
    markbase=nofregisteredmarks,
    markbasenode=base,
    markmark=mkmk,
    checkmark=checkmark,
   }
  end
 else
  properties[start]={
   injections={
    markx=dx,
    marky=dy,
    markdir=rlmode or 0,
    markbase=nofregisteredmarks,
    markbasenode=base,
    markmark=mkmk,
    checkmark=checkmark,
   },
  }
 end
 return dx,dy,nofregisteredmarks
end
local function dir(n)
 return (n and n<0 and "r-to-l") or (n and n>0 and "l-to-r") or "unset"
end
local function showchar(n,nested)
 local char=getchar(n)
 report_injections("%wfont %s, char %U, glyph %c",nested and 2 or 0,getfont(n),char,char)
end
local function show(n,what,nested,symbol)
 if n then
  local p=rawget(properties,n)
  if p then
   local i=p[what]
   if i then
    local leftkern=i.leftkern  or 0
    local rightkern=i.rightkern or 0
    local yoffset=i.yoffset   or 0
    local markx=i.markx  or 0
    local marky=i.marky  or 0
    local markdir=i.markdir   or 0
    local markbase=i.markbase  or 0
    local cursivex=i.cursivex  or 0
    local cursivey=i.cursivey  or 0
    local ligaindex=i.ligaindex or 0
    local cursbase=i.cursiveanchor
    local margin=nested and 4 or 2
    if rightkern~=0 or yoffset~=0 then
     report_injections("%w%s pair: lx %p, rx %p, dy %p",margin,symbol,leftkern,rightkern,yoffset)
    elseif leftkern~=0 then
     report_injections("%w%s kern: dx %p",margin,symbol,leftkern)
    end
    if markx~=0 or marky~=0 or markbase~=0 then
     report_injections("%w%s mark: dx %p, dy %p, dir %s, base %s",margin,symbol,markx,marky,markdir,markbase~=0 and "yes" or "no")
    end
    if cursivex~=0 or cursivey~=0 then
     if cursbase then
      report_injections("%w%s curs: base dx %p, dy %p",margin,symbol,cursivex,cursivey)
     else
      report_injections("%w%s curs: dx %p, dy %p",margin,symbol,cursivex,cursivey)
     end
    elseif cursbase then
     report_injections("%w%s curs: base",margin,symbol)
    end
    if ligaindex~=0 then
     report_injections("%w%s liga: index %i",margin,symbol,ligaindex)
    end
   end
  end
 end
end
local function showsub(n,what,where)
 report_injections("begin subrun: %s",where)
 for n in nextchar,n do
  showchar(n,where)
  show(n,what,where," ")
 end
 report_injections("end subrun")
end
local function trace(head,where)
 report_injections()
 report_injections("begin run %s: %s kerns, %s positions, %s marks and %s cursives registered",
  where or "",nofregisteredkerns,nofregisteredpositions,nofregisteredmarks,nofregisteredcursives)
 local n=head
 while n do
  local id=getid(n)
  if id==glyph_code then
   showchar(n)
   show(n,"injections",false," ")
   show(n,"preinjections",false,"<")
   show(n,"postinjections",false,">")
   show(n,"replaceinjections",false,"=")
   show(n,"emptyinjections",false,"*")
  elseif id==disc_code then
   local pre,post,replace=getdisc(n)
   if pre then
    showsub(pre,"preinjections","pre")
   end
   if post then
    showsub(post,"postinjections","post")
   end
   if replace then
    showsub(replace,"replaceinjections","replace")
   end
   show(n,"emptyinjections",false,"*")
  end
  n=getnext(n)
 end
 report_injections("end run")
end
local function show_result(head)
 local current=head
 local skipping=false
 while current do
  local id=getid(current)
  if id==glyph_code then
   local w=getwidth(current)
   local x,y=getoffsets(current)
   report_injections("char: %C, width %p, xoffset %p, yoffset %p",getchar(current),w,x,y)
   skipping=false
  elseif id==kern_code then
   report_injections("kern: %p",getkern(current))
   skipping=false
  elseif not skipping then
   report_injections()
   skipping=true
  end
  current=getnext(current)
 end
 report_injections()
end
local function inject_kerns_only(head,where)
 if trace_injections then
  trace(head,"kerns")
 end
 local current=head
 local prev=nil
 local next=nil
 local prevdisc=nil
 local pre=nil 
 local post=nil 
 local replace=nil 
 local pretail=nil 
 local posttail=nil 
 local replacetail=nil 
 while current do
  local next=getnext(current)
  local char,id=ischar(current)
  if char then
   local p=rawget(properties,current)
   if p then
    local i=p.injections
    if i then
     local leftkern=i.leftkern
     if leftkern and leftkern~=0 then
      if prev and getid(prev)==glue_code then
       if useitalickerns then
        head=insertnodebefore(head,current,italickern(leftkern))
       else
        setwidth(prev,getwidth(prev)+leftkern)
       end
      else
       head=insertnodebefore(head,current,fontkern(leftkern))
      end
     end
    end
    if prevdisc then
     local done=false
     if post then
      local i=p.postinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        setlink(posttail,fontkern(leftkern))
        done=true
       end
      end
     end
     if replace then
      local i=p.replaceinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        setlink(replacetail,fontkern(leftkern))
        done=true
       end
      end
     else
      local i=p.emptyinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        replace=fontkern(leftkern)
        done=true
       end
      end
     end
     if done then
      setdisc(prevdisc,pre,post,replace)
     end
    end
   end
   prevdisc=nil
  elseif char==false then
   prevdisc=nil
  elseif id==disc_code then
   pre,post,replace,pretail,posttail,replacetail=getdisc(current,true)
   local done=false
   if pre then
    for n in nextchar,pre do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.preinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        pre=insertnodebefore(pre,n,fontkern(leftkern))
        done=true
       end
      end
     end
    end
   end
   if post then
    for n in nextchar,post do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.postinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        post=insertnodebefore(post,n,fontkern(leftkern))
        done=true
       end
      end
     end
    end
   end
   if replace then
    for n in nextchar,replace do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.replaceinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        replace=insertnodebefore(replace,n,fontkern(leftkern))
        done=true
       end
      end
     end
    end
   end
   if done then
    setdisc(current,pre,post,replace)
   end
   prevdisc=current
  else
   prevdisc=nil
  end
  prev=current
  current=next
 end
 if keepregisteredcounts then
  keepregisteredcounts=false
 else
  nofregisteredkerns=0
 end
 if trace_injections then
  show_result(head)
 end
 return head
end
local function inject_positions_only(head,where)
 if trace_injections then
  trace(head,"positions")
 end
 local current=head
 local prev=nil
 local next=nil
 local prevdisc=nil
 local prevglyph=nil
 local pre=nil 
 local post=nil 
 local replace=nil 
 local pretail=nil 
 local posttail=nil 
 local replacetail=nil 
 while current do
  local next=getnext(current)
  local char,id=ischar(current)
  if char then
   local p=rawget(properties,current)
   if p then
    local i=p.injections
    if i then
     local yoffset=i.yoffset
     if yoffset and yoffset~=0 then
      setoffsets(current,false,yoffset)
     end
     local leftkern=i.leftkern
     local rightkern=i.rightkern
     if leftkern and leftkern~=0 then
      if rightkern and leftkern==-rightkern then
       setoffsets(current,leftkern,false)
       rightkern=0
      elseif prev and getid(prev)==glue_code then
       if useitalickerns then
        head=insertnodebefore(head,current,italickern(leftkern))
       else
        setwidth(prev,getwidth(prev)+leftkern)
       end
      else
       head=insertnodebefore(head,current,fontkern(leftkern))
      end
     end
     if rightkern and rightkern~=0 then
      if next and getid(next)==glue_code then
       if useitalickerns then
        insertnodeafter(head,current,italickern(rightkern))
       else
        setwidth(next,getwidth(next)+rightkern)
       end
      else
       insertnodeafter(head,current,fontkern(rightkern))
      end
     end
    elseif next then
     local i=p.emptyinjections
     if i then
      local rightkern=i.rightkern
      if rightkern and rightkern~=0 and getid(next)==disc_code then
       local replace=getreplace(next)
       if replace then
       else
        setreplace(next,fontkern(rightkern))
       end
      end
     end
    end
    if prevdisc then
     local done=false
     if post then
      local i=p.postinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        setlink(posttail,fontkern(leftkern))
        done=true
       end
      end
     end
     if replace then
      local i=p.replaceinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        setlink(replacetail,fontkern(leftkern))
        done=true
       end
      end
     else
      local i=p.emptyinjections
      if i then
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        replace=fontkern(leftkern)
        done=true
       end
      end
     end
     if done then
      setdisc(prevdisc,pre,post,replace)
     end
    end
   end
   prevdisc=nil
   prevglyph=current
  elseif char==false then
   prevdisc=nil
   prevglyph=current
  elseif id==disc_code then
   pre,post,replace,pretail,posttail,replacetail=getdisc(current,true)
   local done=false
   if pre then
    for n in nextchar,pre do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.preinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        pre=insertnodebefore(pre,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(pre,n,fontkern(rightkern))
        done=true
       end
      end
     end
    end
   end
   if post then
    for n in nextchar,post do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.postinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        post=insertnodebefore(post,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(post,n,fontkern(rightkern))
        done=true
       end
      end
     end
    end
   end
   if replace then
    for n in nextchar,replace do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.replaceinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        replace=insertnodebefore(replace,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(replace,n,fontkern(rightkern))
        done=true
       end
      end
     end
    end
   end
   if prevglyph then
    if pre then
     local p=rawget(properties,prevglyph)
     if p then
      local i=p.preinjections
      if i then
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        pre=insertnodebefore(pre,pre,fontkern(rightkern))
        done=true
       end
      end
     end
    end
    if replace then
     local p=rawget(properties,prevglyph)
     if p then
      local i=p.replaceinjections
      if i then
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        replace=insertnodebefore(replace,replace,fontkern(rightkern))
        done=true
       end
      end
     end
    end
   end
   if done then
    setdisc(current,pre,post,replace)
   end
   prevglyph=nil
   prevdisc=current
  else
   prevglyph=nil
   prevdisc=nil
  end
  prev=current
  current=next
 end
 if keepregisteredcounts then
  keepregisteredcounts=false
 else
  nofregisteredpositions=0
 end
 if trace_injections then
  show_result(head)
 end
 return head
end
local function showoffset(n,flag)
 local x,y=getoffsets(n)
 if x~=0 or y~=0 then
  setcolor(n,"darkgray")
 end
end
local function inject_everything(head,where)
 if trace_injections then
  trace(head,"everything")
 end
 local hascursives=nofregisteredcursives>0
 local hasmarks=nofregisteredmarks>0
 local current=head
 local last=nil
 local prev=nil
 local next=nil
 local prevdisc=nil
 local prevglyph=nil
 local pre=nil 
 local post=nil 
 local replace=nil 
 local pretail=nil 
 local posttail=nil 
 local replacetail=nil
 local cursiveanchor=nil
 local minc=0
 local maxc=0
 local glyphs={}
 local marks={}
 local nofmarks=0
 local function processmark(p,n,pn) 
  local px,py=getoffsets(p)
  local nx,ny=getoffsets(n)
  local ox=0
  local rightkern=nil
  local pp=rawget(properties,p)
  if pp then
   pp=pp.injections
   if pp then
    rightkern=pp.rightkern
   end
  end
  local markdir=pn.markdir
  if rightkern then 
   ox=px-(pn.markx or 0)-rightkern
   if markdir and markdir<0 then
    if not pn.markmark then
     ox=ox+(pn.leftkern or 0)
    end
   else
    if false then
     local leftkern=pp.leftkern
     if leftkern then
      ox=ox-leftkern
     end
    end
   end
  else
   ox=px-(pn.markx or 0)
   if markdir and markdir<0 then
    if not pn.markmark then
     local leftkern=pn.leftkern
     if leftkern then
      ox=ox+leftkern 
     end
    end
   end
   if pn.checkmark then
    local wn=getwidth(n) 
    if wn and wn~=0 then
     wn=wn/2
     if trace_injections then
      report_injections("correcting non zero width mark %C",getchar(n))
     end
     insertnodebefore(n,n,fontkern(-wn))
     insertnodeafter(n,n,fontkern(-wn))
    end
   end
  end
  local oy=ny+py+(pn.marky or 0)
  if not pn.markmark then
   local yoffset=pn.yoffset
   if yoffset then
    oy=oy+yoffset 
   end
  end
  setoffsets(n,ox,oy)
  if trace_marks then
   showoffset(n,true)
  end
 end
 while current do
  local next=getnext(current)
  local char,id=ischar(current)
  if char then
   local p=rawget(properties,current)
   if p then
    local i=p.injections
    if i then
     local pm=i.markbasenode
     if pm then
      nofmarks=nofmarks+1
      marks[nofmarks]=current
     else
      local yoffset=i.yoffset
      if yoffset and yoffset~=0 then
       setoffsets(current,false,yoffset)
      end
      if hascursives then
       local cursivex=i.cursivex
       if cursivex then
        if cursiveanchor then
         if cursivex~=0 then
          i.leftkern=(i.leftkern or 0)+cursivex
         end
         if maxc==0 then
          minc=1
          maxc=1
          glyphs[1]=cursiveanchor
         else
          maxc=maxc+1
          glyphs[maxc]=cursiveanchor
         end
         properties[cursiveanchor].cursivedy=i.cursivey 
         last=current
        else
         maxc=0
        end
       elseif maxc>0 then
        local nx,ny=getoffsets(current)
        for i=maxc,minc,-1 do
         local ti=glyphs[i]
         ny=ny+properties[ti].cursivedy
         setoffsets(ti,false,ny) 
         if trace_cursive then
          showoffset(ti)
         end
        end
        maxc=0
        cursiveanchor=nil
       end
       if i.cursiveanchor then
        cursiveanchor=current 
       else
        if maxc>0 then
         local nx,ny=getoffsets(current)
         for i=maxc,minc,-1 do
          local ti=glyphs[i]
          ny=ny+properties[ti].cursivedy
          setoffsets(ti,false,ny) 
          if trace_cursive then
           showoffset(ti)
          end
         end
         maxc=0
        end
        cursiveanchor=nil
       end
      end
      local leftkern=i.leftkern
      local rightkern=i.rightkern
      if leftkern and leftkern~=0 then
       if rightkern and leftkern==-rightkern then
        setoffsets(current,leftkern,false)
        rightkern=0
       elseif prev and getid(prev)==glue_code then
        if useitalickerns then
         head=insertnodebefore(head,current,italickern(leftkern))
        else
         setwidth(prev,getwidth(prev)+leftkern)
        end
       else
        head=insertnodebefore(head,current,fontkern(leftkern))
       end
      end
      if rightkern and rightkern~=0 then
       if next and getid(next)==glue_code then
        if useitalickerns then
         insertnodeafter(head,current,italickern(rightkern))
        else
         setwidth(next,getwidth(next)+rightkern)
        end
       else
        insertnodeafter(head,current,fontkern(rightkern))
       end
      end
     end
    elseif next then
     local i=p.emptyinjections
     if i then
      local rightkern=i.rightkern
      if rightkern and rightkern~=0 and getid(next)==disc_code then
       local replace=getreplace(next)
       if replace then
       else
        setreplace(next,fontkern(rightkern))
       end
      end
     end
    end
    if prevdisc then
     if p then
      local done=false
      if post then
       local i=p.postinjections
       if i then
        local leftkern=i.leftkern
        if leftkern and leftkern~=0 then
         setlink(posttail,fontkern(leftkern))
         done=true
        end
       end
      end
      if replace then
       local i=p.replaceinjections
       if i then
        local leftkern=i.leftkern
        if leftkern and leftkern~=0 then
         setlink(replacetail,fontkern(leftkern))
         done=true
        end
       end
      else
       local i=p.emptyinjections
       if i then
        local leftkern=i.leftkern
        if leftkern and leftkern~=0 then
         replace=fontkern(leftkern)
         done=true
        end
       end
      end
      if done then
       setdisc(prevdisc,pre,post,replace)
      end
     end
    end
   else
    if hascursives and maxc>0 then
     local nx,ny=getoffsets(current)
     for i=maxc,minc,-1 do
      local ti=glyphs[i]
      ny=ny+properties[ti].cursivedy
      local xi,yi=getoffsets(ti)
      setoffsets(ti,xi,yi+ny) 
     end
     maxc=0
     cursiveanchor=nil
    end
   end
   prevdisc=nil
   prevglyph=current
  elseif char==false then
   prevdisc=nil
   prevglyph=current
  elseif id==disc_code then
   pre,post,replace,pretail,posttail,replacetail=getdisc(current,true)
   local done=false
   if pre then
    for n in nextchar,pre do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.preinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        pre=insertnodebefore(pre,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(pre,n,fontkern(rightkern))
        done=true
       end
       if hasmarks then
        local pm=i.markbasenode
        if pm then
         processmark(pm,n,i)
        end
       end
      end
     end
    end
   end
   if post then
    for n in nextchar,post do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.postinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        post=insertnodebefore(post,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(post,n,fontkern(rightkern))
        done=true
       end
       if hasmarks then
        local pm=i.markbasenode
        if pm then
         processmark(pm,n,i)
        end
       end
      end
     end
    end
   end
   if replace then
    for n in nextchar,replace do
     local p=rawget(properties,n)
     if p then
      local i=p.injections or p.replaceinjections
      if i then
       local yoffset=i.yoffset
       if yoffset and yoffset~=0 then
        setoffsets(n,false,yoffset)
       end
       local leftkern=i.leftkern
       if leftkern and leftkern~=0 then
        replace=insertnodebefore(replace,n,fontkern(leftkern))
        done=true
       end
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        insertnodeafter(replace,n,fontkern(rightkern))
        done=true
       end
       if hasmarks then
        local pm=i.markbasenode
        if pm then
         processmark(pm,n,i)
        end
       end
      end
     end
    end
   end
   if prevglyph then
    if pre then
     local p=rawget(properties,prevglyph)
     if p then
      local i=p.preinjections
      if i then
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        pre=insertnodebefore(pre,pre,fontkern(rightkern))
        done=true
       end
      end
     end
    end
    if replace then
     local p=rawget(properties,prevglyph)
     if p then
      local i=p.replaceinjections
      if i then
       local rightkern=i.rightkern
       if rightkern and rightkern~=0 then
        replace=insertnodebefore(replace,replace,fontkern(rightkern))
        done=true
       end
      end
     end
    end
   end
   if done then
    setdisc(current,pre,post,replace)
   end
   prevglyph=nil
   prevdisc=current
  else
   prevglyph=nil
   prevdisc=nil
  end
  prev=current
  current=next
 end
 if hascursives and maxc>0 then
  local nx,ny=getoffsets(last)
  for i=maxc,minc,-1 do
   local ti=glyphs[i]
   ny=ny+properties[ti].cursivedy
   setoffsets(ti,false,ny) 
   if trace_cursive then
    showoffset(ti)
   end
  end
 end
 if nofmarks>0 then
  for i=1,nofmarks do
   local m=marks[i]
   local p=rawget(properties,m)
   local i=p.injections
   local b=i.markbasenode
   processmark(b,m,i)
  end
 elseif hasmarks then
 end
 if keepregisteredcounts then
  keepregisteredcounts=false
 else
  nofregisteredkerns=0
  nofregisteredpositions=0
  nofregisteredmarks=0
  nofregisteredcursives=0
 end
 if trace_injections then
  show_result(head)
 end
 return head
end
local triggers=false
function nodes.injections.setspacekerns(font,sequence)
 if triggers then
  triggers[font]=sequence
 else
  triggers={ [font]=sequence }
 end
end
local getthreshold
if context then
 local threshold=1 
 local parameters=fonts.hashes.parameters
 directives.register("otf.threshold",function(v) threshold=tonumber(v) or 1 end)
 getthreshold=function(font)
  local p=parameters[font]
  local f=p.factor
  local s=p.spacing
  local t=threshold*(s and s.width or p.space or 0)-2
  return t>0 and t or 0,f
 end
else
 injections.threshold=0
 getthreshold=function(font)
  local p=fontdata[font].parameters
  local f=p.factor
  local s=p.spacing
  local t=injections.threshold*(s and s.width or p.space or 0)-2
  return t>0 and t or 0,f
 end
end
injections.getthreshold=getthreshold
function injections.isspace(n,threshold,id)
 if (id or getid(n))==glue_code then
  local w=getwidth(n)
  if threshold and w>threshold then 
   return 32
  end
 end
end
local getspaceboth=getboth
function injections.installgetspaceboth(gb)
 getspaceboth=gb or getboth
end
local function injectspaces(head)
 if not triggers then
  return head
 end
 local lastfont=nil
 local spacekerns=nil
 local leftkerns=nil
 local rightkerns=nil
 local factor=0
 local threshold=0
 local leftkern=false
 local rightkern=false
 local function updatefont(font,trig)
  leftkerns=trig.left
  rightkerns=trig.right
  lastfont=font
  threshold,
  factor=getthreshold(font)
 end
 for n in nextglue,head do
  local prev,next=getspaceboth(n)
  local prevchar=prev and ischar(prev)
  local nextchar=next and ischar(next)
  if nextchar then
   local font=getfont(next)
   local trig=triggers[font]
   if trig then
    if lastfont~=font then
     updatefont(font,trig)
    end
    if rightkerns then
     rightkern=rightkerns[nextchar]
    end
   end
  end
  if prevchar then
   local font=getfont(prev)
   local trig=triggers[font]
   if trig then
    if lastfont~=font then
     updatefont(font,trig)
    end
    if leftkerns then
     leftkern=leftkerns[prevchar]
    end
   end
  end
  if leftkern then
   local old=getwidth(n)
   if old>threshold then
    if rightkern then
     if useitalickerns then
      local lnew=leftkern*factor
      local rnew=rightkern*factor
      if trace_spaces then
       report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar)
      end
      head=insertnodebefore(head,n,italickern(lnew))
      insertnodeafter(head,n,italickern(rnew))
     else
      local new=old+(leftkern+rightkern)*factor
      if trace_spaces then
       report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar)
      end
      setwidth(n,new)
     end
     rightkern=false
    else
     if useitalickerns then
      local new=leftkern*factor
      if trace_spaces then
       report_spaces("%C [%p + %p]",prevchar,old,new)
      end
      insertnodeafter(head,n,italickern(new)) 
     else
      local new=old+leftkern*factor
      if trace_spaces then
       report_spaces("%C [%p -> %p]",prevchar,old,new)
      end
      setwidth(n,new)
     end
    end
   end
   leftkern=false
  elseif rightkern then
   local old=getwidth(n)
   if old>threshold then
    if useitalickerns then
     local new=rightkern*factor
     if trace_spaces then
      report_spaces("[%p + %p] %C",old,new,nextchar)
     end
     insertnodeafter(head,n,italickern(new))
    else
     local new=old+rightkern*factor
     if trace_spaces then
      report_spaces("[%p -> %p] %C",old,new,nextchar)
     end
     setwidth(n,new)
    end
   else
   end
   rightkern=false
  end
 end
 triggers=false
 return head
end
function injections.handler(head,where)
 if triggers then
  head=injectspaces(head)
 end
 if nofregisteredmarks>0 or nofregisteredcursives>0 then
  if trace_injections then
   report_injections("injection variant %a","everything")
  end
  return inject_everything(head,where)
 elseif nofregisteredpositions>0 then
  if trace_injections then
   report_injections("injection variant %a","positions")
  end
  return inject_positions_only(head,where)
 elseif nofregisteredkerns>0 then
  if trace_injections then
   report_injections("injection variant %a","kerns")
  end
  return inject_kerns_only(head,where)
 else
  return head
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otj”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ota” 2bb12d708e35bc05443eba791e2554e7] ---

if not modules then modules={} end modules ['font-ota']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local type=type
local setmetatableindex=table.setmetatableindex
if not trackers then trackers={ register=function() end } end
local fonts,nodes,node=fonts,nodes,node
local allocate=utilities.storage.allocate
local otf=fonts.handlers.otf
local analyzers=fonts.analyzers
local initializers=allocate()
local methods=allocate()
analyzers.initializers=initializers
analyzers.methods=methods
local nuts=nodes.nuts
local tonut=nuts.tonut
local getnext=nuts.getnext
local getprev=nuts.getprev
local getprev=nuts.getprev
local getprop=nuts.getprop
local setprop=nuts.setprop
local getsubtype=nuts.getsubtype
local getchar=nuts.getchar
local ischar=nuts.ischar
local endofmath=nuts.endofmath
local nodecodes=nodes.nodecodes
local disc_code=nodecodes.disc
local math_code=nodecodes.math
local fontdata=fonts.hashes.identifiers
local categories=characters and characters.categories or {} 
local chardata=characters and characters.data
local otffeatures=fonts.constructors.features.otf
local registerotffeature=otffeatures.register
local setstate=nuts.setstate
local getstate=nuts.getstate
if not setstate or not getstate then
 setstate=function(n,v)
  setprop(n,"state",v)
 end
 getstate=function(n,v)
  local s=getprop(n,"state")
  if v then
   return s==v
  else
   return s
  end
 end
 nuts.setstate=setstate
 nuts.getstate=getstate
end
local s_init=1 local s_rphf=7
local s_medi=2 local s_half=8
local s_fina=3 local s_pref=9
local s_isol=4 local s_blwf=10
local s_mark=5 local s_pstf=11
local s_rest=6
local states=allocate {
 init=s_init,
 medi=s_medi,
 med2=s_medi,
 fina=s_fina,
 fin2=s_fina,
 fin3=s_fina,
 isol=s_isol,
 mark=s_mark,
 rest=s_rest,
 rphf=s_rphf,
 half=s_half,
 pref=s_pref,
 blwf=s_blwf,
 pstf=s_pstf,
}
local features=allocate {
 init=s_init,
 medi=s_medi,
 med2=s_medi,
 fina=s_fina,
 fin2=s_fina,
 fin3=s_fina,
 isol=s_isol,
 rphf=s_rphf,
 half=s_half,
 pref=s_pref,
 blwf=s_blwf,
 pstf=s_pstf,
}
analyzers.states=states
analyzers.features=features
analyzers.useunicodemarks=false
function analyzers.setstate(head,font)
 local useunicodemarks=analyzers.useunicodemarks
 local tfmdata=fontdata[font]
 local descriptions=tfmdata.descriptions
 local first,last,current,n,done=nil,nil,head,0,false 
 current=tonut(current)
 while current do
  local char,id=ischar(current,font)
  if char and not getstate(current) then
   done=true
   local d=descriptions[char]
   if d then
    if d.class=="mark" then
     done=true
     setstate(current,s_mark)
    elseif useunicodemarks and categories[char]=="mn" then
     done=true
     setstate(current,s_mark)
    elseif n==0 then
     first,last,n=current,current,1
     setstate(current,s_init)
    else
     last,n=current,n+1
     setstate(current,s_medi)
    end
   else 
    if first and first==last then
     setstate(last,s_isol)
    elseif last then
     setstate(last,s_fina)
    end
    first,last,n=nil,nil,0
   end
  elseif char==false then
   if first and first==last then
    setstate(last,s_isol)
   elseif last then
    setstate(last,s_fina)
   end
   first,last,n=nil,nil,0
   if id==math_code then
    current=endofmath(current)
   end
  elseif id==disc_code then
   setstate(current,s_medi)
   last=current
  else 
   if first and first==last then
    setstate(last,s_isol)
   elseif last then
    setstate(last,s_fina)
   end
   first,last,n=nil,nil,0
   if id==math_code then
    current=endofmath(current)
   end
  end
  current=getnext(current)
 end
 if first and first==last then
  setstate(last,s_isol)
 elseif last then
  setstate(last,s_fina)
 end
 return head,done
end
local function analyzeinitializer(tfmdata,value) 
 local script,language=otf.scriptandlanguage(tfmdata) 
 local action=initializers[script]
 if not action then
 elseif type(action)=="function" then
  return action(tfmdata,value)
 else
  local action=action[language]
  if action then
   return action(tfmdata,value)
  end
 end
end
local function analyzeprocessor(head,font,attr)
 local tfmdata=fontdata[font]
 local script,language=otf.scriptandlanguage(tfmdata,attr)
 local action=methods[script]
 if not action then
 elseif type(action)=="function" then
  return action(head,font,attr)
 else
  action=action[language]
  if action then
   return action(head,font,attr)
  end
 end
 return head,false
end
registerotffeature {
 name="analyze",
 description="analysis of character classes",
 default=true,
 initializers={
  node=analyzeinitializer,
 },
 processors={
  position=1,
  node=analyzeprocessor,
 }
}
methods.latn=analyzers.setstate
local arab_warned={}
local function warning(current,what)
 local char=getchar(current)
 if not arab_warned[char] then
  log.report("analyze","arab: character %C has no %a class",char,what)
  arab_warned[char]=true
 end
end
local mappers=allocate {
 l=s_init,
 d=s_medi,
 c=s_medi,
 r=s_fina,
 u=s_isol,
}
local classifiers=characters.classifiers
if not classifiers then
 local f_arabic,l_arabic=characters.blockrange("arabic")
 local f_syriac,l_syriac=characters.blockrange("syriac")
 local f_mandiac,l_mandiac=characters.blockrange("mandiac")
 local f_nko,l_nko=characters.blockrange("nko")
 local f_ext_a,l_ext_a=characters.blockrange("arabicextendeda")
 classifiers=setmetatableindex(function(t,k)
  if type(k)=="number" then
   local c=chardata[k]
   local v=false
   if c then
    local arabic=c.arabic
    if arabic then
     v=mappers[arabic]
     if not v then
      log.report("analyze","error in mapping arabic %C",k)
      v=false
     end
    elseif (k>=f_arabic  and k<=l_arabic)  or
        (k>=f_syriac  and k<=l_syriac)  or
        (k>=f_mandiac and k<=l_mandiac) or
        (k>=f_nko  and k<=l_nko)  or
        (k>=f_ext_a   and k<=l_ext_a)   then
     if categories[k]=="mn" then
      v=s_mark
     else
      v=s_rest
     end
    end
   end
   t[k]=v
   return v
  end
 end)
 characters.classifiers=classifiers
end
function methods.arab(head,font,attr)
 local first,last,c_first,c_last
 local current=head
 local done=false
 current=tonut(current)
 while current do
  local char,id=ischar(current,font)
  if char and not getstate(current) then
   done=true
   local classifier=classifiers[char]
   if not classifier then
    if last then
     if c_last==s_medi or c_last==s_fina then
      setstate(last,s_fina)
     else
      warning(last,"fina")
      setstate(last,s_error)
     end
     first,last=nil,nil
    elseif first then
     if c_first==s_medi or c_first==s_fina then
      setstate(first,s_isol)
     else
      warning(first,"isol")
      setstate(first,s_error)
     end
     first=nil
    end
   elseif classifier==s_mark then
    setstate(current,s_mark)
   elseif classifier==s_isol then
    if last then
     if c_last==s_medi or c_last==s_fina then
      setstate(last,s_fina)
     else
      warning(last,"fina")
      setstate(last,s_error)
     end
     first,last=nil,nil
    elseif first then
     if c_first==s_medi or c_first==s_fina then
      setstate(first,s_isol)
     else
      warning(first,"isol")
      setstate(first,s_error)
     end
     first=nil
    end
    setstate(current,s_isol)
   elseif classifier==s_medi then
    if first then
     last=current
     c_last=classifier
     setstate(current,s_medi)
    else
     setstate(current,s_init)
     first=current
     c_first=classifier
    end
   elseif classifier==s_fina then
    if last then
     if getstate(last)~=s_init then
      setstate(last,s_medi)
     end
     setstate(current,s_fina)
     first,last=nil,nil
    elseif first then
     setstate(current,s_fina)
     first=nil
    else
     setstate(current,s_isol)
    end
   else 
    setstate(current,s_rest)
    if last then
     if c_last==s_medi or c_last==s_fina then
      setstate(last,s_fina)
     else
      warning(last,"fina")
      setstate(last,s_error)
     end
     first,last=nil,nil
    elseif first then
     if c_first==s_medi or c_first==s_fina then
      setstate(first,s_isol)
     else
      warning(first,"isol")
      setstate(first,s_error)
     end
     first=nil
    end
   end
  else
   if last then
    if c_last==s_medi or c_last==s_fina then
     setstate(last,s_fina)
    else
     warning(last,"fina")
     setstate(last,s_error)
    end
    first,last=nil,nil
   elseif first then
    if c_first==s_medi or c_first==s_fina then
     setstate(first,s_isol)
    else
     warning(first,"isol")
     setstate(first,s_error)
    end
    first=nil
   end
   if id==math_code then 
    current=endofmath(current)
   end
  end
  current=getnext(current)
 end
 if last then
  if c_last==s_medi or c_last==s_fina then
   setstate(last,s_fina)
  else
   warning(last,"fina")
   setstate(last,s_error)
  end
 elseif first then
  if c_first==s_medi or c_first==s_fina then
   setstate(first,s_isol)
  else
   warning(first,"isol")
   setstate(first,s_error)
  end
 end
 return head,done
end
methods.syrc=methods.arab
methods.mand=methods.arab
methods.nko=methods.arab
do
 local joining=setmetatableindex(function(t,k)
  if type(k)=="number" then
   local c=chardata[k]
   local v=false
   if c then
    local mongolian=c.mongolian
    v=mongolian
   end
   t[k]=v
   return v
  end
 end)
 function methods.mong(head,font,attr)
  local first,last
  local current=head
  local done=false
  local prevjoin=nil
  local prestate=nil
  current=tonut(current)
  local function wrapup()
   if last then
    if last~=first then
     local s=getstate(last)
     if s==s_medi then
      setstate(last,s_fina)
     elseif s==s_init then
      setstate(last,s_isol)
     end
    end
    last=nil
    first=nil
    prevjoin=nil
    prestate=nil
   end
  end
  while current do
   local char,id=ischar(current,font)
   if char and not getstate(current) then
    local currjoin=joining[char]
    done=true
    if not last then
     setstate(current,s_isol)
     prevjoin=currjoin
     first=current
     last=current
     prevstate=s_isol
    elseif currjoin=="t" then
     last=current
    elseif prevjoin=="d" or prevjoin=="jc" or prevjoin=="l" then
     if currjoin=="d" or prevjoin=="jc" or prevjoin=="r" then
      local s=getstate(last)
      if s==s_isol then
       setstate(last,s_init)
      elseif s==s_fina then
       setstate(last,s_medi)
      end
      setstate(current,s_fina)
      prevstate=s_fina
     elseif prevjoin=="nj" or prevjoin=="l" then
      local s=getstate(last)
      if s==s_medi then
       setstate(last,s_fina)
      elseif s==s_init then
       setstate(last,s_isol)
      end
      setstate(current,s_isol)
      prevstate=s_isol
     end
     prevjoin=currjoin
     last=current
    elseif prevjoin=="nj" or prevjoin=="r" then
     if s==s_medi then
      setstate(last,s_fina)
     elseif s==s_init then
      setstate(last,s_isol)
     end
     setstate(current,s_isol)
     prevjoin=currjoin
     prevstate=s_isol
     last=current
    elseif last then
     wrapup()
    end
   else
    if last then
     wrapup()
    end
    if id==math_code then 
     current=endofmath(current)
    end
   end
   current=getnext(current)
  end
  if last then
   wrapup()
  end
  return head,done
 end
end
directives.register("otf.analyze.useunicodemarks",function(v)
 analyzers.useunicodemarks=v
end)

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ota”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ots” 55316a605d11a1d07d38795224c90a63] ---

if not modules then modules={} end modules ['font-ots']={ 
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files",
}
local type,next,tonumber=type,next,tonumber
local random=math.random
local formatters=string.formatters
local insert=table.insert
local registertracker=trackers.register
local logs=logs
local trackers=trackers
local nodes=nodes
local attributes=attributes
local fonts=fonts
local otf=fonts.handlers.otf
local tracers=nodes.tracers
local trace_singles=false  registertracker("otf.singles",function(v) trace_singles=v end)
local trace_multiples=false  registertracker("otf.multiples",function(v) trace_multiples=v end)
local trace_alternatives=false  registertracker("otf.alternatives",function(v) trace_alternatives=v end)
local trace_ligatures=false  registertracker("otf.ligatures",function(v) trace_ligatures=v end)
local trace_contexts=false  registertracker("otf.contexts",function(v) trace_contexts=v end)
local trace_marks=false  registertracker("otf.marks",function(v) trace_marks=v end)
local trace_kerns=false  registertracker("otf.kerns",function(v) trace_kerns=v end)
local trace_cursive=false  registertracker("otf.cursive",function(v) trace_cursive=v end)
local trace_preparing=false  registertracker("otf.preparing",function(v) trace_preparing=v end)
local trace_bugs=false  registertracker("otf.bugs",function(v) trace_bugs=v end)
local trace_details=false  registertracker("otf.details",function(v) trace_details=v end)
local trace_steps=false  registertracker("otf.steps",function(v) trace_steps=v end)
local trace_skips=false  registertracker("otf.skips",function(v) trace_skips=v end)
local trace_plugins=false  registertracker("otf.plugins",function(v) trace_plugins=v end)
local trace_chains=false  registertracker("otf.chains",function(v) trace_chains=v end)
local trace_kernruns=false  registertracker("otf.kernruns",function(v) trace_kernruns=v end)
local trace_compruns=false  registertracker("otf.compruns",function(v) trace_compruns=v end)
local trace_testruns=false  registertracker("otf.testruns",function(v) trace_testruns=v end)
local forcediscretionaries=false
local forcepairadvance=false 
local repeatablemultiples=context or false
directives.register("otf.forcediscretionaries",function(v)
 forcediscretionaries=v
end)
directives.register("otf.forcepairadvance",function(v)
 forcepairadvance=v
end)
local report_direct=logs.reporter("fonts","otf direct")
local report_subchain=logs.reporter("fonts","otf subchain")
local report_chain=logs.reporter("fonts","otf chain")
local report_process=logs.reporter("fonts","otf process")
local report_warning=logs.reporter("fonts","otf warning")
local report_run=logs.reporter("fonts","otf run")
registertracker("otf.substitutions","otf.singles","otf.multiples","otf.alternatives","otf.ligatures")
registertracker("otf.positions","otf.marks","otf.kerns","otf.cursive")
registertracker("otf.actions","otf.substitutions","otf.positions")
registertracker("otf.sample","otf.steps","otf.substitutions","otf.positions","otf.analyzing")
registertracker("otf.sample.silent","otf.steps=silent","otf.substitutions","otf.positions","otf.analyzing")
local nuts=nodes.nuts
local getnext=nuts.getnext
local setnext=nuts.setnext
local getprev=nuts.getprev
local setprev=nuts.setprev
local getboth=nuts.getboth
local setboth=nuts.setboth
local getid=nuts.getid
local getstate=nuts.getstate
local getsubtype=nuts.getsubtype
local setsubtype=nuts.setsubtype
local getchar=nuts.getchar
local setchar=nuts.setchar
local getdisc=nuts.getdisc
local setdisc=nuts.setdisc
local getreplace=nuts.getreplace
local setlink=nuts.setlink
local getwidth=nuts.getwidth
local getattr=nuts.getattr
local getglyphdata=nuts.getglyphdata
local components=nuts.components
local copynocomponents=components.copynocomponents
local copyonlyglyphs=components.copyonlyglyphs
local countcomponents=components.count
local setcomponents=components.set
local getcomponents=components.get
local flushcomponents=components.flush
local ischar=nuts.ischar
local usesfont=nuts.usesfont
local insertnodeafter=nuts.insertafter
local copy_node=nuts.copy
local copy_node_list=nuts.copylist
local remove_node=nuts.remove
local find_node_tail=nuts.tail
local flushnodelist=nuts.flushlist
local flushnode=nuts.flushnode
local endofmath=nuts.endofmath
local startofpar=nuts.startofpar
local setmetatable=setmetatable
local setmetatableindex=table.setmetatableindex
local nextnode=nuts.traversers.node
local nodecodes=nodes.nodecodes
local glyphcodes=nodes.glyphcodes
local disccodes=nodes.disccodes
local glyph_code=nodecodes.glyph
local glue_code=nodecodes.glue
local disc_code=nodecodes.disc
local math_code=nodecodes.math
local dir_code=nodecodes.dir
local par_code=nodecodes.par
local lefttoright_code=nodes.dirvalues.lefttoright
local righttoleft_code=nodes.dirvalues.righttoleft
local discretionarydisc_code=disccodes.discretionary
local ligatureglyph_code=glyphcodes.ligature
local a_noligature=attributes.private("noligature")
local injections=nodes.injections
local setmark=injections.setmark
local setcursive=injections.setcursive
local setkern=injections.setkern
local setmove=injections.setmove
local setposition=injections.setposition
local resetinjection=injections.reset
local copyinjection=injections.copy
local setligaindex=injections.setligaindex
local getligaindex=injections.getligaindex
local fontdata=fonts.hashes.identifiers
local fontfeatures=fonts.hashes.features
local otffeatures=fonts.constructors.features.otf
local registerotffeature=otffeatures.register
local onetimemessage=fonts.loggers.onetimemessage or function() end
local getrandom=utilities and utilities.randomizer and utilities.randomizer.get
otf.defaultnodealternate="none"
local tfmdata=false
local characters=false
local descriptions=false
local marks=false
local classes=false
local currentfont=false
local factor=0
local threshold=0
local checkmarks=false
local discs=false
local spaces=false
local sweepnode=nil
local sweephead={} 
local notmatchpre={} 
local notmatchpost={} 
local notmatchreplace={} 
local handlers={}
local isspace=injections.isspace
local getthreshold=injections.getthreshold
local checkstep=(tracers and tracers.steppers.check) or function() end
local registerstep=(tracers and tracers.steppers.register) or function() end
local registermessage=(tracers and tracers.steppers.message)  or function() end
local function logprocess(...)
 if trace_steps then
  registermessage(...)
  if trace_steps=="silent" then
   return
  end
 end
 report_direct(...)
end
local function logwarning(...)
 report_direct(...)
end
local gref  do
 local f_unicode=formatters["U+%X"]   
 local f_uniname=formatters["U+%X (%s)"] 
 local f_unilist=formatters["% t"]
 gref=function(n) 
  if type(n)=="number" then
   local description=descriptions[n]
   local name=description and description.name
   if name then
    return f_uniname(n,name)
   else
    return f_unicode(n)
   end
  elseif n then
   local t={}
   for i=1,#n do
    local ni=n[i]
    if tonumber(ni) then 
     local di=descriptions[ni]
     local nn=di and di.name
     if nn then
      t[#t+1]=f_uniname(ni,nn)
     else
      t[#t+1]=f_unicode(ni)
     end
    end
   end
   return f_unilist(t)
  else
   return "<error in node mode tracing>"
  end
 end
end
local function cref(dataset,sequence,index)
 if not dataset then
  return "no valid dataset"
 end
 local merged=sequence.merged and "merged " or ""
 if index then
  return formatters["feature %a, type %a, %schain lookup %a, index %a"](
   dataset[4],sequence.type,merged,sequence.name,index)
 else
  return formatters["feature %a, type %a, %schain lookup %a"](
   dataset[4],sequence.type,merged,sequence.name)
 end
end
local function pref(dataset,sequence)
 return formatters["feature %a, type %a, %slookup %a"](
  dataset[4],sequence.type,sequence.merged and "merged " or "",sequence.name)
end
local function mref(rlmode)
 if not rlmode or rlmode>=0 then
  return "l2r"
 else
  return "r2l"
 end
end
local function flattendisk(head,disc)
 local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
 local prev,next=getboth(disc)
 local ishead=head==disc
 setdisc(disc)
 flushnode(disc)
 if pre then
  flushnodelist(pre)
 end
 if post then
  flushnodelist(post)
 end
 if ishead then
  if replace then
   if next then
    setlink(replacetail,next)
   end
   return replace,replace
  elseif next then
   return next,next
  else
  end
 else
  if replace then
   if next then
    setlink(replacetail,next)
   end
   setlink(prev,replace)
   return head,replace
  else
   setlink(prev,next) 
   return head,next
  end
 end
end
local function appenddisc(disc,list)
 local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
 local posthead=list
 local replacehead=copy_node_list(list)
 if post then
  setlink(posttail,posthead)
 else
  post=posthead
 end
 if replace then
  setlink(replacetail,replacehead)
 else
  replace=replacehead
 end
 setdisc(disc,pre,post,replace)
end
local function markstoligature(head,start,stop,char)
 if start==stop and getchar(start)==char then
  return head,start
 else
  local prev=getprev(start)
  local next=getnext(stop)
  setprev(start)
  setnext(stop)
  local base=copynocomponents(start,copyinjection)
  if head==start then
   head=base
  end
  resetinjection(base)
  setchar(base,char)
  setsubtype(base,ligatureglyph_code)
  setcomponents(base,start)
  setlink(prev,base,next)
  flushcomponents(start)
  return head,base
 end
end
local no_left_ligature_code=1
local no_right_ligature_code=2
local no_left_kern_code=4
local no_right_kern_code=8
local hasglyphoption=function(n,c)
 if c==no_left_ligature_code or c==no_right_ligature_code then
  return getattr(n,a_noligature)==1
 else
  return false
 end
end
local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound,hasmarks) 
 if hasglyphoption(start,no_right_ligature_code) then
  return head,start
 end
 if start==stop and getchar(start)==char then
  resetinjection(start)
  setchar(start,char)
  return head,start
 end
 local prev=getprev(start)
 local next=getnext(stop)
 local comp=start
 setprev(start)
 setnext(stop)
 local base=copynocomponents(start,copyinjection)
 if start==head then
  head=base
 end
 resetinjection(base)
 setchar(base,char)
 setsubtype(base,ligatureglyph_code)
 setcomponents(base,comp)
 setlink(prev,base,next)
 if not discfound then
  local deletemarks=not skiphash or hasmarks
  local components=start 
  local baseindex=0
  local componentindex=0
  local head=base
  local current=base
  while start do
   local char=getchar(start)
   if not marks[char] then
    baseindex=baseindex+componentindex
    componentindex=countcomponents(start,marks)
   elseif not deletemarks then
    setligaindex(start,baseindex+getligaindex(start,componentindex))
    if trace_marks then
     logwarning("%s: keep ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
    end
    local n=copy_node(start)
    copyinjection(n,start) 
    head,current=insertnodeafter(head,current,n) 
   elseif trace_marks then
    logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char))
   end
   start=getnext(start)
  end
  local start=getnext(current)
  while start do
   local char=ischar(start)
   if char then
    if marks[char] then
     setligaindex(start,baseindex+getligaindex(start,componentindex))
     if trace_marks then
      logwarning("%s: set ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
     end
     start=getnext(start)
    else
     break
    end
   else
    break
   end
  end
  flushcomponents(components)
 else
  local discprev,discnext=getboth(discfound)
  if discprev and discnext then
   local pre,post,replace,pretail,posttail,replacetail=getdisc(discfound,true)
   if not replace then
    local prev=getprev(base)
    local copied=copyonlyglyphs(comp)
    if pre then
     setlink(discprev,pre)
    else
     setnext(discprev) 
    end
    pre=comp 
    if post then
     setlink(posttail,discnext)
     setprev(post) 
    else
     post=discnext
     setprev(discnext) 
    end
    setlink(prev,discfound,next)
    setboth(base)
    setcomponents(base,copied)
    replace=base
    if forcediscretionaries then
     setdisc(discfound,pre,post,replace,discretionarydisc_code)
    else
     setdisc(discfound,pre,post,replace)
    end
    base=prev
   end
  end
 end
 return head,base
end
local function multiple_glyphs(head,start,multiple,skiphash,what,stop) 
 local nofmultiples=#multiple
 if nofmultiples>0 then
  resetinjection(start)
  setchar(start,multiple[1])
  if nofmultiples>1 then
   local sn=getnext(start)
   for k=2,nofmultiples do
    local n=copy_node(start) 
    resetinjection(n)
    setchar(n,multiple[k])
    insertnodeafter(head,start,n)
    start=n
   end
   if what~=true and repeatablemultiples then
    local kind=type(what)
    local m,f,l
    if kind=="string" then
     local what,n=string.match(what,"^repeat(.-)[:=](%d+)$")
     if what=="middle" then
      m=tonumber(n)
     elseif what=="first" then
      f=tonumber(n)
     elseif what=="last" then
      l=tonumber(n)
     end
    elseif kind=="table" then
       m=what.middle
       f=what.first
       l=what.last
    end
    if f or m or l then
     if m and m>1 and nofmultiples==3 then
      local middle=getnext(first)
      for i=2,m do
       local n=copynode(middle) 
       resetinjection(n)
       insertnodeafter(head,first,n)
      end
     end
     if f and f>1 then
      for i=2,f do
       local n=copynode(first) 
       resetinjection(n)
       insertnodeafter(head,first,n)
      end
     end
     if l and l>1 then
      for i=2,l do
       local n=copynode(start) 
       resetinjection(n)
       insertnodeafter(head,start,n)
       start=n
      end
     end
    end
   end
  end
  return head,start,true
 else
  if trace_multiples then
   logprocess("no multiple for %s",gref(getchar(start)))
  end
  return head,start,false
 end
end
local function get_alternative_glyph(start,alternatives,value)
 local n=#alternatives
 if n==1 then
  return alternatives[1],trace_alternatives and "1 (only one present)"
 elseif value=="random" then
  local r=getrandom and getrandom("glyph",1,n) or random(1,n)
  return alternatives[r],trace_alternatives and formatters["value %a, taking %a"](value,r)
 elseif value=="first" then
  return alternatives[1],trace_alternatives and formatters["value %a, taking %a"](value,1)
 elseif value=="last" then
  return alternatives[n],trace_alternatives and formatters["value %a, taking %a"](value,n)
 end
 value=value==true and 1 or tonumber(value)
 if type(value)~="number" then
  return alternatives[1],trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
 end
 if value>n then
  local defaultalt=otf.defaultnodealternate
  if defaultalt=="first" then
   return alternatives[n],trace_alternatives and formatters["invalid value %s, taking %a"](value,1)
  elseif defaultalt=="last" then
   return alternatives[1],trace_alternatives and formatters["invalid value %s, taking %a"](value,n)
  else
   return false,trace_alternatives and formatters["invalid value %a, %s"](value,"out of range")
  end
 elseif value==0 then
  return getchar(start),trace_alternatives and formatters["invalid value %a, %s"](value,"no change")
 elseif value<1 then
  return alternatives[1],trace_alternatives and formatters["invalid value %a, taking %a"](value,1)
 else
  return alternatives[value],trace_alternatives and formatters["value %a, taking %a"](value,value)
 end
end
function handlers.gsub_single(head,start,dataset,sequence,replacement)
 if trace_singles then
  logprocess("%s: replacing %s by single %s",pref(dataset,sequence),gref(getchar(start)),gref(replacement))
 end
 resetinjection(start)
 setchar(start,replacement)
 return head,start,true
end
function handlers.gsub_alternate(head,start,dataset,sequence,alternative)
 local kind=dataset[4]
 local what=dataset[1]
 local value=what==true and tfmdata.shared.features[kind] or what
 local choice,comment=get_alternative_glyph(start,alternative,value)
 if choice then
  if trace_alternatives then
   logprocess("%s: replacing %s by alternative %a to %s, %s",pref(dataset,sequence),gref(getchar(start)),gref(choice),comment)
  end
  resetinjection(start)
  setchar(start,choice)
 else
  if trace_alternatives then
   logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment)
  end
 end
 return head,start,true
end
function handlers.gsub_multiple(head,start,dataset,sequence,multiple,rlmode,skiphash)
 if trace_multiples then
  logprocess("%s: replacing %s by multiple %s",pref(dataset,sequence),gref(getchar(start)),gref(multiple))
 end
 return multiple_glyphs(head,start,multiple,skiphash,dataset[1])
end
function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skiphash)
 local current=getnext(start)
 if not current then
  return head,start,false,nil
 end
 local stop=nil
 local startchar=getchar(start)
 if skiphash and skiphash[startchar] then
  while current do
   local char=ischar(current,currentfont)
   if char then
    local lg=not tonumber(ligature) and ligature[char]
    if lg then
     stop=current
     ligature=lg
     current=getnext(current)
    else
     break
    end
   else
    break
   end
  end
  if stop then
   local ligature=tonumber(ligature) or ligature.ligature
   if ligature then
    if trace_ligatures then
     local stopchar=getchar(stop)
     head,start=markstoligature(head,start,stop,ligature)
     logprocess("%s: replacing %s upto %s by ligature %s case 1",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(getchar(start)))
    else
     head,start=markstoligature(head,start,stop,ligature)
    end
    return head,start,true,false
   else
   end
  end
 else
  local discfound=false
  local hasmarks=marks[startchar]
  while current do
   local char,id=ischar(current,currentfont)
   if char then
    if skiphash and skiphash[char] then
     current=getnext(current)
    else
     local lg=not tonumber(ligature) and ligature[char]
     if lg then
      if marks[char] then
       hasmarks=true
      end
      stop=current 
      ligature=lg
      current=getnext(current)
     else
      break
     end
    end
   elseif char==false then
    break
   elseif id==disc_code then
    discfound=current
    break
   else
    break
   end
  end
  if discfound then
   local pre,post,replace=getdisc(discfound)
   local match
   if replace then
    local char=ischar(replace,currentfont)
    if char and (not tonumber(ligature) and ligature[char]) then
     match=true
    end
   end
   if not match and pre then
    local char=ischar(pre,currentfont)
    if char and (not tonumber(ligature) and ligature[char]) then
     match=true
    end
   end
   if not match and not pre or not replace then
    local n=getnext(discfound)
    local char=ischar(n,currentfont)
    if char and (not tonumber(ligature) and ligature[char]) then
     match=true
    end
   end
   if match then
    local ishead=head==start
    local prev=getprev(start)
    if stop then
     setnext(stop)
     local copy=copy_node_list(start)
     local tail=stop 
     local liat=find_node_tail(copy)
     if pre then
      setlink(liat,pre)
     end
     if replace then
      setlink(tail,replace)
     end
     pre=copy
     replace=start
    else
     setnext(start)
     local copy=copy_node(start)
     if pre then
      setlink(copy,pre)
     end
     if replace then
      setlink(start,replace)
     end
     pre=copy
     replace=start
    end
    setdisc(discfound,pre,post,replace)
    if prev then
     setlink(prev,discfound)
    else
     setprev(discfound)
     head=discfound
    end
    start=discfound
    return head,start,true,true
   end
  end
  local ligature=tonumber(ligature) or ligature.ligature
  if ligature then
   if stop then
    if trace_ligatures then
     local stopchar=getchar(stop)
     head,start=toligature(head,start,stop,ligature,dataset,sequence,skiphash,false,hasmarks)
     logprocess("%s: replacing %s upto %s by ligature %s case 2",pref(dataset,sequence),gref(startchar),gref(stopchar),gref(ligature))
    else
     head,start=toligature(head,start,stop,ligature,dataset,sequence,skiphash,false,hasmarks)
    end
   else
    resetinjection(start)
    setchar(start,ligature)
    if trace_ligatures then
     logprocess("%s: replacing %s by (no real) ligature %s case 3",pref(dataset,sequence),gref(startchar),gref(ligature))
    end
   end
   return head,start,true,false
  else
  end
 end
 return head,start,false,false
end
function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
 if hasglyphoption(start,no_right_kern_code) then
  return head,start,false
 else
  local startchar=getchar(start)
  local format=step.format
  if format=="single" or type(kerns)=="table" then 
   local dx,dy,w,h=setposition(0,start,factor,rlmode,kerns,injection)
   if trace_kerns then
    logprocess("%s: shifting single %s by %s xy (%p,%p) and wh (%p,%p)",pref(dataset,sequence),gref(startchar),format,dx,dy,w,h)
   end
  else
   local k=(format=="move" and setmove or setkern)(start,factor,rlmode,kerns,injection)
   if trace_kerns then
    logprocess("%s: shifting single %s by %s %p",pref(dataset,sequence),gref(startchar),format,k)
   end
  end
  return head,start,true
 end
end
function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
 if hasglyphoption(start,no_right_kern_code) then
  return head,start,false
 else
  local snext=getnext(start)
  if not snext then
   return head,start,false
  else
   local prev=start
   while snext do
    local nextchar=ischar(snext,currentfont)
    if nextchar then
     if skiphash and skiphash[nextchar] then 
      prev=snext
      snext=getnext(snext)
     else
      local krn=kerns[nextchar]
      if not krn then
       break
      end
      local format=step.format
      if format=="pair" then
       local a=krn[1]
       local b=krn[2]
       if a==true then
       elseif a then 
        local x,y,w,h=setposition(1,start,factor,rlmode,a,injection)
        if trace_kerns then
         local startchar=getchar(start)
         logprocess("%s: shifting first of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections")
        end
       end
       if b==true then
        start=snext 
       elseif b then 
        local x,y,w,h=setposition(2,snext,factor,rlmode,b,injection)
        if trace_kerns then
         local startchar=getchar(start)
         logprocess("%s: shifting second of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections")
        end
        start=snext 
       elseif forcepairadvance then
        start=snext 
       end
       return head,start,true
      elseif krn~=0 then
       local k=(format=="move" and setmove or setkern)(snext,factor,rlmode,krn,injection)
       if trace_kerns then
        logprocess("%s: inserting %s %p between %s and %s as %s",pref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar),injection or "injections")
       end
       return head,start,true
      else 
       break
      end
     end
    else
     break
    end
   end
   return head,start,false
  end
 end
end
function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,skiphash)
 local markchar=getchar(start)
 if marks[markchar] then
  local base=getprev(start) 
  if base then
   local basechar=ischar(base,currentfont)
   if basechar then
    if marks[basechar] then
     while base do
      base=getprev(base)
      if base then
       basechar=ischar(base,currentfont)
       if basechar then
        if not marks[basechar] then
         break
        end
       else
        if trace_bugs then
         logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),1)
        end
        return head,start,false
       end
      else
       if trace_bugs then
        logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),2)
       end
       return head,start,false
      end
     end
    end
    local ba=markanchors[1][basechar]
    if ba then
     local ma=markanchors[2]
     local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
     if trace_marks then
      logprocess("%s, bound %s, anchoring mark %s to basechar %s => (%p,%p)",
       pref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
     end
     return head,start,true
    elseif trace_bugs then
     logwarning("%s: mark %s is not anchored to %s",pref(dataset,sequence),gref(markchar),gref(basechar))
    end
   elseif trace_bugs then
    logwarning("%s: nothing preceding, case %i",pref(dataset,sequence),1)
   end
  elseif trace_bugs then
   logwarning("%s: nothing preceding, case %i",pref(dataset,sequence),2)
  end
 elseif trace_bugs then
  logwarning("%s: mark %s is no mark",pref(dataset,sequence),gref(markchar))
 end
 return head,start,false
end
function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlmode,skiphash)
 local markchar=getchar(start)
 if marks[markchar] then
  local base=getprev(start) 
  if base then
   local basechar=ischar(base,currentfont)
   if basechar then
    if marks[basechar] then
     while base do
      base=getprev(base)
      if base then
       basechar=ischar(base,currentfont)
       if basechar then
        if not marks[basechar] then
         break
        end
       else
        if trace_bugs then
         logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),1)
        end
        return head,start,false
       end
      else
       if trace_bugs then
        logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),2)
       end
       return head,start,false
      end
     end
    end
    local ba=markanchors[1][basechar]
    if ba then
     local ma=markanchors[2]
     if ma then
      local index=getligaindex(start)
      ba=ba[index]
      if ba then
       local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
       if trace_marks then
        logprocess("%s, index %s, bound %s, anchoring mark %s to baselig %s at index %s => (%p,%p)",
         pref(dataset,sequence),index,bound,gref(markchar),gref(basechar),index,dx,dy)
       end
       return head,start,true
      else
       if trace_bugs then
        logwarning("%s: no matching anchors for mark %s and baselig %s with index %a",pref(dataset,sequence),gref(markchar),gref(basechar),index)
       end
      end
     end
    elseif trace_bugs then
     onetimemessage(currentfont,basechar,"no base anchors")
    end
   elseif trace_bugs then
    logwarning("%s: prev node is no char, case %i",pref(dataset,sequence),1)
   end
  elseif trace_bugs then
   logwarning("%s: prev node is no char, case %i",pref(dataset,sequence),2)
  end
 elseif trace_bugs then
  logwarning("%s: mark %s is no mark",pref(dataset,sequence),gref(markchar))
 end
 return head,start,false
end
function handlers.gpos_mark2mark(head,start,dataset,sequence,markanchors,rlmode,skiphash)
 local markchar=getchar(start)
 if marks[markchar] then
  local base=getprev(start) 
  local slc=getligaindex(start)
  if slc then 
   while base do
    local blc=getligaindex(base)
    if blc and blc~=slc then
     base=getprev(base)
    else
     break
    end
   end
  end
  if base then
   local basechar=ischar(base,currentfont)
   if basechar then 
    local ba=markanchors[1][basechar] 
    if ba then
     local ma=markanchors[2]
     local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],true,checkmarks)
     if trace_marks then
      logprocess("%s, bound %s, anchoring mark %s to basemark %s => (%p,%p)",
       pref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
     end
     return head,start,true
    end
   end
  end
 elseif trace_bugs then
  logwarning("%s: mark %s is no mark",pref(dataset,sequence),gref(markchar))
 end
 return head,start,false
end
function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,skiphash,step) 
 local startchar=getchar(start)
 if marks[startchar] then
  if trace_cursive then
   logprocess("%s: ignoring cursive for mark %s",pref(dataset,sequence),gref(startchar))
  end
 else
  local nxt=getnext(start)
  while nxt do
   local nextchar=ischar(nxt,currentfont)
   if not nextchar then
    break
   elseif marks[nextchar] then 
    nxt=getnext(nxt)
   else
    local exit=exitanchors[3]
    if exit then
     local entry=exitanchors[1][nextchar]
     if entry then
      entry=entry[2]
      if entry then
       local r2lflag=sequence.flags[4] 
       local dx,dy,bound=setcursive(start,nxt,factor,rlmode,exit,entry,characters[startchar],characters[nextchar],r2lflag)
       if trace_cursive then
        logprocess("%s: moving %s to %s cursive (%p,%p) using bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,bound,mref(rlmode))
       end
       return head,start,true
      end
     end
    end
    break
   end
  end
 end
 return head,start,false
end
local chainprocs={}
local function logprocess(...)
 if trace_steps then
  registermessage(...)
  if trace_steps=="silent" then
   return
  end
 end
 report_subchain(...)
end
local logwarning=report_subchain
local function logprocess(...)
 if trace_steps then
  registermessage(...)
  if trace_steps=="silent" then
   return
  end
 end
 report_chain(...)
end
local logwarning=report_chain
local function reversesub(head,start,stop,dataset,sequence,replacements,rlmode,skiphash)
 local char=getchar(start)
 local replacement=replacements[char]
 if replacement then
  if trace_singles then
   logprocess("%s: single reverse replacement of %s by %s",cref(dataset,sequence),gref(char),gref(replacement))
  end
  resetinjection(start)
  setchar(start,replacement)
  return head,start,true
 else
  return head,start,false
 end
end
chainprocs.reversesub=reversesub
local function reportzerosteps(dataset,sequence)
 logwarning("%s: no steps",cref(dataset,sequence))
end
local function reportmoresteps(dataset,sequence)
 logwarning("%s: more than 1 step",cref(dataset,sequence))
end
local function getmapping(dataset,sequence,currentlookup)
 local steps=currentlookup.steps
 local nofsteps=currentlookup.nofsteps
 if nofsteps==0 then
  reportzerosteps(dataset,sequence)
  currentlookup.mapping=false
  return false
 else
  if nofsteps>1 then
   reportmoresteps(dataset,sequence)
  end
  local mapping=steps[1].coverage
  currentlookup.mapping=mapping
  currentlookup.format=steps[1].format
  return mapping
 end
end
function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 if trace_chains then
  logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start)))
 end
 head,start=remove_node(head,start,true)
 return head,getprev(start),true
end
function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local current=start
  while current do
   local currentchar=ischar(current)
   if currentchar then
    local replacement=mapping[currentchar]
    if not replacement or replacement=="" then
     if trace_bugs then
      logwarning("%s: no single for %s",cref(dataset,sequence,chainindex),gref(currentchar))
     end
    else
     if trace_singles then
      logprocess("%s: replacing single %s by %s",cref(dataset,sequence,chainindex),gref(currentchar),gref(replacement))
     end
     resetinjection(current)
     setchar(current,replacement)
    end
    return head,start,true
   elseif currentchar==false then
    break
   elseif current==stop then
    break
   else
    current=getnext(current)
   end
  end
 end
 return head,start,false
end
function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local kind=dataset[4]
  local what=dataset[1]
  local value=what==true and tfmdata.shared.features[kind] or what 
  local current=start
  while current do
   local currentchar=ischar(current)
   if currentchar then
    local alternatives=mapping[currentchar]
    if alternatives then
     local choice,comment=get_alternative_glyph(current,alternatives,value)
     if choice then
      if trace_alternatives then
       logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(currentchar),choice,gref(choice),comment)
      end
      resetinjection(start)
      setchar(start,choice)
     else
      if trace_alternatives then
       logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(currentchar),comment)
      end
     end
    end
    return head,start,true
   elseif currentchar==false then
    break
   elseif current==stop then
    break
   else
    current=getnext(current)
   end
  end
 end
 return head,start,false
end
function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local startchar=getchar(start)
  local replacement=mapping[startchar]
  if not replacement or replacement=="" then
   if trace_bugs then
    logwarning("%s: no multiple for %s",cref(dataset,sequence),gref(startchar))
   end
  else
   if trace_multiples then
    logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement))
   end
   return multiple_glyphs(head,start,replacement,skiphash,dataset[1],stop)
  end
 end
 return head,start,false
end
function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local startchar=getchar(start)
  local ligatures=mapping[startchar]
  if not ligatures then
   if trace_bugs then
    logwarning("%s: no ligatures starting with %s",cref(dataset,sequence,chainindex),gref(startchar))
   end
  else
   local hasmarks=marks[startchar]
   local current=getnext(start)
   local discfound=false
   local last=stop
   local nofreplacements=1
   while current do
    local id=getid(current)
    if id==disc_code then
     if not discfound then
      discfound=current
     end
     if current==stop then
      break 
     else
      current=getnext(current)
     end
    else
     local schar=getchar(current)
     if skiphash and skiphash[schar] then
       current=getnext(current)
     else
      local lg=not tonumber(ligatures) and ligatures[schar]
      if lg then
       ligatures=lg
       last=current
       nofreplacements=nofreplacements+1
       if marks[char] then
        hasmarks=true
       end
       if current==stop then
        break
       else
        current=getnext(current)
       end
      else
       break
      end
     end
    end
   end
   local ligature=tonumber(ligatures) or ligatures.ligature
   if ligature then
    if chainindex then
     stop=last
    end
    if trace_ligatures then
     if start==stop then
      logprocess("%s: replacing character %s by ligature %s case 3",cref(dataset,sequence,chainindex),gref(startchar),gref(ligature))
     else
      logprocess("%s: replacing character %s upto %s by ligature %s case 4",cref(dataset,sequence,chainindex),gref(startchar),gref(getchar(stop)),gref(ligature))
     end
    end
    head,start=toligature(head,start,stop,ligature,dataset,sequence,skiphash,discfound,hasmarks)
    return head,start,true,nofreplacements,discfound
   elseif trace_bugs then
    if start==stop then
     logwarning("%s: replacing character %s by ligature fails",cref(dataset,sequence,chainindex),gref(startchar))
    else
     logwarning("%s: replacing character %s upto %s by ligature fails",cref(dataset,sequence,chainindex),gref(startchar),gref(getchar(stop)))
    end
   end
  end
 end
 return head,start,false,0,false
end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 if not hasglyphoption(start,no_right_kern_code) then
  local mapping=currentlookup.mapping
  if mapping==nil then
   mapping=getmapping(dataset,sequence,currentlookup)
  end
  if mapping then
   local startchar=getchar(start)
   local kerns=mapping[startchar]
   if kerns then
    local format=currentlookup.format
    if format=="single" then
     local dx,dy,w,h=setposition(0,start,factor,rlmode,kerns) 
     if trace_kerns then
      logprocess("%s: shifting single %s by %s (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),format,dx,dy,w,h)
     end
    else 
     local k=(format=="move" and setmove or setkern)(start,factor,rlmode,kerns,injection)
     if trace_kerns then
      logprocess("%s: shifting single %s by %s %p",cref(dataset,sequence),gref(startchar),format,k)
     end
    end
    return head,start,true
   end
  end
 end
 return head,start,false
end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 if not hasglyphoption(start,no_right_kern_code) then
  local mapping=currentlookup.mapping
  if mapping==nil then
   mapping=getmapping(dataset,sequence,currentlookup)
  end
  if mapping then
   local snext=getnext(start)
   if snext then
    local startchar=getchar(start)
    local kerns=mapping[startchar] 
    if kerns then
     local prev=start
     while snext do
      local nextchar=ischar(snext,currentfont)
      if not nextchar then
       break
      end
      if skiphash and skiphash[nextchar] then
       prev=snext
       snext=getnext(snext)
      else
       local krn=kerns[nextchar]
       if not krn then
        break
       end
       local format=currentlookup.format
       if format=="pair" then
        local a=krn[1]
        local b=krn[2]
        if a==true then
        elseif a then
         local x,y,w,h=setposition(1,start,factor,rlmode,a,"injections") 
         if trace_kerns then
          local startchar=getchar(start)
          logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h)
         end
        end
        if b==true then
         start=snext 
        elseif b then 
         local x,y,w,h=setposition(2,snext,factor,rlmode,b,"injections")
         if trace_kerns then
          local startchar=getchar(start)
          logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h)
         end
         start=snext 
        elseif forcepairadvance then
         start=snext 
        end
        return head,start,true
       elseif krn~=0 then
        local k=(format=="move" and setmove or setkern)(snext,factor,rlmode,krn)
        if trace_kerns then
         logprocess("%s: inserting %s %p between %s and %s",cref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar))
        end
        return head,start,true
       else
        break
       end
      end
     end
    end
   end
  end
 end
 return head,start,false
end
function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local markchar=getchar(start)
  if marks[markchar] then
   local markanchors=mapping[markchar] 
   if markanchors then
    local base=getprev(start) 
    if base then
     local basechar=ischar(base,currentfont)
     if basechar then
      if marks[basechar] then
       while base do
        base=getprev(base)
        if base then
         local basechar=ischar(base,currentfont)
         if basechar then
          if not marks[basechar] then
           break
          end
         else
          if trace_bugs then
           logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),1)
          end
          return head,start,false
         end
        else
         if trace_bugs then
          logwarning("%s: no base for mark %s, case %i",pref(dataset,sequence),gref(markchar),2)
         end
         return head,start,false
        end
       end
      end
      local ba=markanchors[1][basechar]
      if ba then
       local ma=markanchors[2]
       if ma then
        local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
        if trace_marks then
         logprocess("%s, bound %s, anchoring mark %s to basechar %s => (%p,%p)",
          cref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
        end
        return head,start,true
       end
      end
     elseif trace_bugs then
      logwarning("%s: prev node is no char, case %i",cref(dataset,sequence),1)
     end
    elseif trace_bugs then
     logwarning("%s: prev node is no char, case %i",cref(dataset,sequence),2)
    end
   elseif trace_bugs then
    logwarning("%s: mark %s has no anchors",cref(dataset,sequence),gref(markchar))
   end
  elseif trace_bugs then
   logwarning("%s: mark %s is no mark",cref(dataset,sequence),gref(markchar))
  end
 end
 return head,start,false
end
function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local markchar=getchar(start)
  if marks[markchar] then
   local markanchors=mapping[markchar] 
   if markanchors then
    local base=getprev(start) 
    if base then
     local basechar=ischar(base,currentfont)
     if basechar then
      if marks[basechar] then
       while base do
        base=getprev(base)
        if base then
         local basechar=ischar(base,currentfont)
         if basechar then
          if not marks[basechar] then
           break
          end
         else
          if trace_bugs then
           logwarning("%s: no base for mark %s, case %i",cref(dataset,sequence),markchar,1)
          end
          return head,start,false
         end
        else
         if trace_bugs then
          logwarning("%s: no base for mark %s, case %i",cref(dataset,sequence),markchar,2)
         end
         return head,start,false
        end
       end
      end
      local ba=markanchors[1][basechar]
      if ba then
       local ma=markanchors[2]
       if ma then
        local index=getligaindex(start)
        ba=ba[index]
        if ba then
         local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
         if trace_marks then
          logprocess("%s, bound %s, anchoring mark %s to baselig %s at index %s => (%p,%p)",
           cref(dataset,sequence),a or bound,gref(markchar),gref(basechar),index,dx,dy)
         end
         return head,start,true
        end
       end
      end
     elseif trace_bugs then
      logwarning("%s, prev node is no char, case %i",cref(dataset,sequence),1)
     end
    elseif trace_bugs then
     logwarning("%s, prev node is no char, case %i",cref(dataset,sequence),2)
    end
   elseif trace_bugs then
    logwarning("%s, mark %s has no anchors",cref(dataset,sequence),gref(markchar))
   end
  elseif trace_bugs then
   logwarning("%s, mark %s is no mark",cref(dataset,sequence),gref(markchar))
  end
 end
 return head,start,false
end
function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local markchar=getchar(start)
  if marks[markchar] then
   local markanchors=mapping[markchar] 
   if markanchors then
    local base=getprev(start) 
    local slc=getligaindex(start)
    if slc then 
     while base do
      local blc=getligaindex(base)
      if blc and blc~=slc then
       base=getprev(base)
      else
       break
      end
     end
    end
    if base then 
     local basechar=ischar(base,currentfont)
     if basechar then
      local ba=markanchors[1][basechar]
      if ba then
       local ma=markanchors[2]
       if ma then
        local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],true,checkmarks)
        if trace_marks then
         logprocess("%s, bound %s, anchoring mark %s to basemark %s => (%p,%p)",
          cref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
        end
        return head,start,true
       end
      end
     elseif trace_bugs then
      logwarning("%s: prev node is no mark, case %i",cref(dataset,sequence),1)
     end
    elseif trace_bugs then
     logwarning("%s: prev node is no mark, case %i",cref(dataset,sequence),2)
    end
   elseif trace_bugs then
    logwarning("%s: mark %s has no anchors",cref(dataset,sequence),gref(markchar))
   end
  elseif trace_bugs then
   logwarning("%s: mark %s is no mark",cref(dataset,sequence),gref(markchar))
  end
 end
 return head,start,false
end
function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
 local mapping=currentlookup.mapping
 if mapping==nil then
  mapping=getmapping(dataset,sequence,currentlookup)
 end
 if mapping then
  local startchar=getchar(start)
  local exitanchors=mapping[startchar] 
  if exitanchors then
   if marks[startchar] then
    if trace_cursive then
     logprocess("%s: ignoring cursive for mark %s",pref(dataset,sequence),gref(startchar))
    end
   else
    local nxt=getnext(start)
    while nxt do
     local nextchar=ischar(nxt,currentfont)
     if not nextchar then
      break
     elseif marks[nextchar] then
      nxt=getnext(nxt)
     else
      local exit=exitanchors[3]
      if exit then
       local entry=exitanchors[1][nextchar]
       if entry then
        entry=entry[2]
        if entry then
         local r2lflag=sequence.flags[4] 
         local dx,dy,bound=setcursive(start,nxt,factor,rlmode,exit,entry,characters[startchar],characters[nextchar],r2lflag)
         if trace_cursive then
          logprocess("%s: moving %s to %s cursive (%p,%p) using bound %s in %s mode",pref(dataset,sequence),gref(startchar),gref(nextchar),dx,dy,bound,mref(rlmode))
         end
         return head,start,true
        end
       end
      elseif trace_bugs then
       onetimemessage(currentfont,startchar,"no entry anchors")
      end
      break
     end
    end
   end
  elseif trace_cursive and trace_details then
   logprocess("%s, cursive %s is already done",pref(dataset,sequence),gref(getchar(start)),alreadydone)
  end
 end
 return head,start,false
end
local function show_skip(dataset,sequence,char,ck,class)
 logwarning("%s: skipping char %s, class %a, rule %a, lookuptype %a",cref(dataset,sequence),gref(char),class,ck[1],ck[8] or ck[2])
end
local userkern=nuts.pool and nuts.pool.newkern 
do if not userkern then 
 local thekern=nuts.new("kern",1) 
 local setkern=nuts.setkern    
 userkern=function(k)
  local n=copy_node(thekern)
  setkern(n,k)
  return n
 end
end end
local function checked(head)
 local current=head
 while current do
  if getid(current)==glue_code then
   local kern=userkern(getwidth(current))
   if head==current then
    local next=getnext(current)
    if next then
     setlink(kern,next)
    end
    flushnode(current)
    head=kern
    current=next
   else
    local prev,next=getboth(current)
    setlink(prev,kern,next)
    flushnode(current)
    current=next
   end
  else
   current=getnext(current)
  end
 end
 return head
end
local function setdiscchecked(d,pre,post,replace)
 if pre  then pre=checked(pre)  end
 if post then post=checked(post) end
 if replace then replace=checked(replace) end
 setdisc(d,pre,post,replace)
end
local noflags={ false,false,false,false }
local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck)
 local size=ck[5]-ck[4]+1
 local chainlookups=ck[6]
 local done=false
 if chainlookups then
  if size==1 then
   local chainlookup=chainlookups[1]
   for j=1,#chainlookup do
    local chainstep=chainlookup[j]
    local chainkind=chainstep.type
    local chainproc=chainprocs[chainkind]
    if chainproc then
     local ok
     head,start,ok=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1)
     if ok then
      done=true
     end
    else
     logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind)
    end
   end
   else
   local i=1
   local laststart=start
   local nofchainlookups=#chainlookups 
   while start do
    if skiphash then 
     while start do
      local char=ischar(start,currentfont)
      if char then
       if skiphash and skiphash[char] then
        start=getnext(start)
       else
        break
       end
      else
       break
      end
     end
    end
    local chainlookup=chainlookups[i]
    if chainlookup then
     for j=1,#chainlookup do
      local chainstep=chainlookup[j]
      local chainkind=chainstep.type
      local chainproc=chainprocs[chainkind]
      if chainproc then
       local ok,n
       head,start,ok,n=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i)
       if ok then
        done=true
        if n and n>1 and i+n>nofchainlookups then
         i=size 
         break
        end
       end
      else
       logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind)
      end
     end
    else
    end
    i=i+1
    if i>size or not start then
     break
    elseif start then
     laststart=start
     start=getnext(start)
    end
   end
   if not start then
    start=laststart
   end
  end
 else
  local replacements=ck[7]
  if replacements then
   head,start,done=reversesub(head,start,last,dataset,sequence,replacements,rlmode,skiphash)
  else
   done=true
   if trace_contexts then
    logprocess("%s: skipping match",cref(dataset,sequence))
   end
  end
 end
 return head,start,done
end
local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
 if not start then
  return head,start,false
 end
 local startishead=start==head
 local seq=ck[3]
 local f=ck[4]
 local l=ck[5]
 local s=#seq
 local done=false
 local sweepnode=sweepnode
 local sweeptype=sweeptype
 local sweepoverflow=false
 local checkdisc=getprev(head)
 local keepdisc=not sweepnode
 local lookaheaddisc=nil
 local backtrackdisc=nil
 local current=start
 local last=start
 local prev=getprev(start)
 local hasglue=false
 local i=f
 while i<=l do
  local id=getid(current)
  if id==glyph_code then
   i=i+1
   last=current
   current=getnext(current)
  elseif id==glue_code then
   i=i+1
   last=current
   current=getnext(current)
   hasglue=true
  elseif id==disc_code then
   if keepdisc then
    keepdisc=false
    lookaheaddisc=current
    local replace=getreplace(current)
    if not replace then
     sweepoverflow=true
     sweepnode=current
     current=getnext(current)
    else
     while replace and i<=l do
      if getid(replace)==glyph_code then
       i=i+1
      end
      replace=getnext(replace)
     end
     current=getnext(replace)
    end
    last=current
   else
    head,current=flattendisk(head,current)
   end
  else
   last=current
   current=getnext(current)
  end
  if current then
  elseif sweepoverflow then
   break
  elseif sweeptype=="post" or sweeptype=="replace" then
   current=getnext(sweepnode)
   if current then
    sweeptype=nil
    sweepoverflow=true
   else
    break
   end
  else
   break 
  end
 end
 if sweepoverflow then
  local prev=current and getprev(current)
  if not current or prev~=sweepnode then
   local head=getnext(sweepnode)
   local tail=nil
   if prev then
    tail=prev
    setprev(current,sweepnode)
   else
    tail=find_node_tail(head)
   end
   setnext(sweepnode,current)
   setprev(head)
   setnext(tail)
   appenddisc(sweepnode,head)
  end
 end
 if l<s then
  local i=l
  local t=sweeptype=="post" or sweeptype=="replace"
  while current and i<s do
   local id=getid(current)
   if id==glyph_code then
    i=i+1
    current=getnext(current)
   elseif id==glue_code then
    i=i+1
    current=getnext(current)
    hasglue=true
   elseif id==disc_code then
    if keepdisc then
     keepdisc=false
     if notmatchpre[current]~=notmatchreplace[current] then
      lookaheaddisc=current
     end
     local replace=getreplace(current)
     while replace and i<s do
      if getid(replace)==glyph_code then
       i=i+1
      end
      replace=getnext(replace)
     end
     current=getnext(current)
    elseif notmatchpre[current]~=notmatchreplace[current] then
     head,current=flattendisk(head,current)
    else
     current=getnext(current) 
    end
   else
    current=getnext(current)
   end
   if not current and t then
    current=getnext(sweepnode)
    if current then
     sweeptype=nil
    end
   end
  end
 end
 if f>1 then
  local current=prev
  local i=f
  local t=sweeptype=="pre" or sweeptype=="replace"
  if not current and t and current==checkdisc then
   current=getprev(sweepnode)
  end
  while current and i>1 do 
   local id=getid(current)
   if id==glyph_code then
    i=i-1
   elseif id==glue_code then
    i=i-1
    hasglue=true
   elseif id==disc_code then
    if keepdisc then
     keepdisc=false
     if notmatchpost[current]~=notmatchreplace[current] then
      backtrackdisc=current
     end
     local replace=getreplace(current)
     while replace and i>1 do
      if getid(replace)==glyph_code then
       i=i-1
      end
      replace=getnext(replace)
     end
    elseif notmatchpost[current]~=notmatchreplace[current] then
     head,current=flattendisk(head,current)
    end
   end
   current=getprev(current)
   if t and current==checkdisc then
    current=getprev(sweepnode)
   end
  end
 end
 local done=false
 if lookaheaddisc then
  local cf=start
  local cl=getprev(lookaheaddisc)
  local cprev=getprev(start)
  local insertedmarks=0
  while cprev do
   local char=ischar(cf,currentfont)
   if char and marks[char] then
    insertedmarks=insertedmarks+1
    cf=cprev
    startishead=cf==head
    cprev=getprev(cprev)
   else
    break
   end
  end
  setlink(cprev,lookaheaddisc)
  setprev(cf)
  setnext(cl)
  if startishead then
   head=lookaheaddisc
  end
  local pre,post,replace=getdisc(lookaheaddisc)
  local new=copy_node_list(cf) 
  local cnew=new
  if pre then
   setlink(find_node_tail(cf),pre)
  end
  if replace then
   local tail=find_node_tail(new)
   setlink(tail,replace)
  end
  for i=1,insertedmarks do
   cnew=getnext(cnew)
  end
  cl=start
  local clast=cnew
  for i=f,l do
   cl=getnext(cl)
   clast=getnext(clast)
  end
  if not notmatchpre[lookaheaddisc] then
   local ok=false
   cf,start,ok=chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck)
   if ok then
    done=true
   end
  end
  if not notmatchreplace[lookaheaddisc] then
   local ok=false
   new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck)
   if ok then
    done=true
   end
  end
  if hasglue then
   setdiscchecked(lookaheaddisc,cf,post,new)
  else
   setdisc(lookaheaddisc,cf,post,new)
  end
  start=getprev(lookaheaddisc)
  sweephead[cf]=getnext(clast) or false
  sweephead[new]=getnext(cl) or false
 elseif backtrackdisc then
  local cf=getnext(backtrackdisc)
  local cl=start
  local cnext=getnext(start)
  local insertedmarks=0
  while cnext do
   local char=ischar(cnext,currentfont)
   if char and marks[char] then
    insertedmarks=insertedmarks+1
    cl=cnext
    cnext=getnext(cnext)
   else
    break
   end
  end
  setlink(backtrackdisc,cnext)
  setprev(cf)
  setnext(cl)
  local pre,post,replace,pretail,posttail,replacetail=getdisc(backtrackdisc,true)
  local new=copy_node_list(cf)
  local cnew=find_node_tail(new)
  for i=1,insertedmarks do
   cnew=getprev(cnew)
  end
  local clast=cnew
  for i=f,l do
   clast=getnext(clast)
  end
  if not notmatchpost[backtrackdisc] then
   local ok=false
   cf,start,ok=chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck)
   if ok then
    done=true
   end
  end
  if not notmatchreplace[backtrackdisc] then
   local ok=false
   new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck)
   if ok then
    done=true
   end
  end
  if post then
   setlink(posttail,cf)
  else
   post=cf
  end
  if replace then
   setlink(replacetail,new)
  else
   replace=new
  end
  if hasglue then
   setdiscchecked(backtrackdisc,pre,post,replace)
  else
   setdisc(backtrackdisc,pre,post,replace)
  end
  start=getprev(backtrackdisc)
  sweephead[post]=getnext(clast) or false
  sweephead[replace]=getnext(last) or false
 else
  local ok=false
  head,start,ok=chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck)
  if ok then
   done=true
  end
 end
 return head,start,done
end
local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode)
 local rule=ck[1]
 local lookuptype=ck[8] or ck[2]
 local nofseq=#ck[3]
 local first=ck[4]
 local last=ck[5]
 local char=getchar(start)
 logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping",
  cref(dataset,sequence),rule,match and "matches" or "nomatch",
  gref(char),first-1,last-first+1,nofseq-last,lookuptype,
  discseen and "" or "no ",sweepnode and "" or "not ")
end
local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash)
 local sweepnode=sweepnode
 local sweeptype=sweeptype
 local postreplace
 local prereplace
 local checkdisc
 local discseen  
 if sweeptype then
  if sweeptype=="replace" then
   postreplace=true
   prereplace=true
  else
   postreplace=sweeptype=="post"
   prereplace=sweeptype=="pre"
  end
  checkdisc=getprev(head)
 end
 local currentfont=currentfont
 local skipped   
 local startprev,
    startnext=getboth(start)
 local done
 local nofcontexts=contexts.n 
 local startchar=nofcontext==1 or ischar(start,currentfont) 
 for k=1,nofcontexts do 
  local ck=contexts[k]
  local seq=ck[3]
  local f=ck[4] 
local last=start
  if not startchar or not seq[f][startchar] then
   goto next
  end
  local s=seq.n 
  if s==1 then
  else
   local l=ck[5] 
   local current=start
   if l>f then
    local discfound 
    local n=f+1
    last=startnext 
    while n<=l do
     if postreplace and not last then
      last=getnext(sweepnode)
      sweeptype=nil
     end
     if last then
      local char,id=ischar(last,currentfont)
      if char then
       if skiphash and skiphash[char] then
        skipped=true
        if trace_skips then
         show_skip(dataset,sequence,char,ck,classes[char])
        end
        last=getnext(last)
       elseif seq[n][char] then
        if n<l then
         last=getnext(last)
        end
        n=n+1
       elseif discfound then
        notmatchreplace[discfound]=true
        if notmatchpre[discfound] then
         goto next
        else
         break
        end
       else
        goto next
       end
      elseif char==false then
       if discfound then
        notmatchreplace[discfound]=true
        if notmatchpre[discfound] then
         goto next
        else
         break
        end
       else
        goto next
       end
      elseif id==disc_code then
       discseen=true
       discfound=last
       notmatchpre[last]=nil
       notmatchpost[last]=true
       notmatchreplace[last]=nil
       local pre,post,replace=getdisc(last)
       if pre then
        local n=n
        while pre do
         if seq[n][getchar(pre)] then
          n=n+1
          if n>l then
           break
          end
          pre=getnext(pre)
         else
          notmatchpre[last]=true
          break
         end
        end
        if n<=l then
         notmatchpre[last]=true
        end
       else
        notmatchpre[last]=true
       end
       if replace then
        while replace do
         if seq[n][getchar(replace)] then
          n=n+1
          if n>l then
           break
          end
          replace=getnext(replace)
         else
          notmatchreplace[last]=true
          if notmatchpre[last] then
           goto next
          else
           break
          end
         end
        end
        if notmatchpre[last] then
         goto next
        end
       end
       last=getnext(last)
      else
       goto next
      end
     else
      goto next
     end
    end
   end
   if f>1 then
    if startprev then
     local prev=startprev
     if prereplace and prev==checkdisc then
      prev=getprev(sweepnode)
     end
     if prev then
      local discfound 
      local n=f-1
      while n>=1 do
       if prev then
        local char,id=ischar(prev,currentfont)
        if char then
         if skiphash and skiphash[char] then
          skipped=true
          if trace_skips then
           show_skip(dataset,sequence,char,ck,classes[char])
          end
          prev=getprev(prev)
         elseif seq[n][char] then
          if n>1 then
           prev=getprev(prev)
          end
          n=n-1
         elseif discfound then
          notmatchreplace[discfound]=true
          if notmatchpost[discfound] then
           goto next
          else
           break
          end
         else
          goto next
         end
        elseif char==false then
         if discfound then
          notmatchreplace[discfound]=true
          if notmatchpost[discfound] then
           goto next
          end
         else
          goto next
         end
         break
        elseif id==disc_code then
         discseen=true
         discfound=prev
         notmatchpre[prev]=true
         notmatchpost[prev]=nil
         notmatchreplace[prev]=nil
         local pre,post,replace,pretail,posttail,replacetail=getdisc(prev,true)
         if pre~=start and post~=start and replace~=start then
          if post then
           local n=n
           while posttail do
            if seq[n][getchar(posttail)] then
             n=n-1
             if posttail==post or n<1 then
              break
             else
              posttail=getprev(posttail)
             end
            else
             notmatchpost[prev]=true
             break
            end
           end
           if n>=1 then
            notmatchpost[prev]=true
           end
          else
           notmatchpost[prev]=true
          end
          if replace then
           while replacetail do
            if seq[n][getchar(replacetail)] then
             n=n-1
             if replacetail==replace or n<1 then
              break
             else
              replacetail=getprev(replacetail)
             end
            else
             notmatchreplace[prev]=true
             if notmatchpost[prev] then
              goto next
             else
              break
             end
            end
           end
          else
          end
         end
         prev=getprev(prev)
        elseif id==glue_code then
         local sn=seq[n]
         if (sn[32] and spaces[prev]) or sn[0xFFFC] then
          n=n-1
          prev=getprev(prev)
         else
          goto next
         end
        elseif seq[n][0xFFFC] then
         n=n-1
         prev=getprev(prev)
        else
         goto next
        end
       else
        goto next
       end
      end
     else
      goto next
     end
    else
     goto next
    end
   end
   if s>l then
    local current=last and getnext(last)
    if not current and postreplace then
     current=getnext(sweepnode)
    end
    if current then
     local discfound 
     local n=l+1
     while n<=s do
      if current then
       local char,id=ischar(current,currentfont)
       if char then
        if skiphash and skiphash[char] then
         skipped=true
         if trace_skips then
          show_skip(dataset,sequence,char,ck,classes[char])
         end
         current=getnext(current) 
        elseif seq[n][char] then
         if n<s then 
          current=getnext(current) 
         end
         n=n+1
        elseif discfound then
         notmatchreplace[discfound]=true
         if notmatchpre[discfound] then
          goto next
         else
          break
         end
        else
         goto next
        end
       elseif char==false then
        if discfound then
         notmatchreplace[discfound]=true
         if notmatchpre[discfound] then
          goto next
         else
          break
         end
        else
         goto next
        end
       elseif id==disc_code then
        discseen=true
        discfound=current
        notmatchpre[current]=nil
        notmatchpost[current]=true
        notmatchreplace[current]=nil
        local pre,post,replace=getdisc(current)
        if pre then
         local n=n
         while pre do
          if seq[n][getchar(pre)] then
           n=n+1
           if n>s then
            break
           else
            pre=getnext(pre)
           end
          else
           notmatchpre[current]=true
           break
          end
         end
         if n<=s then
          notmatchpre[current]=true
         end
        else
         notmatchpre[current]=true
        end
        if replace then
         while replace do
          if seq[n][getchar(replace)] then
           n=n+1
           if n>s then
            break
           else
            replace=getnext(replace)
           end
          else
           notmatchreplace[current]=true
           if notmatchpre[current] then
            goto next
           else
            break
           end
          end
         end
        else
        end
        current=getnext(current)
       elseif id==glue_code then
        local sn=seq[n]
        if (sn[32] and spaces[current]) or sn[0xFFFC] then
         n=n+1
         current=getnext(current)
        else
         goto next
        end
       elseif seq[n][0xFFFC] then
        n=n+1
        current=getnext(current)
       else
        goto next
       end
      else
       goto next
      end
     end
    else
     goto next
    end
   end
  end
  if trace_contexts then
   chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode)
  end
  if discseen or sweepnode then
   head,start,done=chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck)
  else
   head,start,done=chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck)
  end
  if done then
   break
  end
  ::next::
 end
 if discseen then
  notmatchpre={}
  notmatchpost={}
  notmatchreplace={}
 end
 return head,start,done
end
handlers.gsub_context=handle_contextchain
handlers.gsub_contextchain=handle_contextchain
handlers.gsub_reversecontextchain=handle_contextchain
handlers.gpos_contextchain=handle_contextchain
handlers.gpos_context=handle_contextchain
local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash)
 local steps=currentlookup.steps
 local nofsteps=currentlookup.nofsteps
 if nofsteps>1 then
  reportmoresteps(dataset,sequence)
 end
 local l=steps[1].coverage[getchar(start)]
 if l then
  return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash)
 else
  return head,start,false
 end
end
chainprocs.gsub_context=chained_contextchain
chainprocs.gsub_contextchain=chained_contextchain
chainprocs.gsub_reversecontextchain=chained_contextchain
chainprocs.gpos_contextchain=chained_contextchain
chainprocs.gpos_context=chained_contextchain
local missing=setmetatableindex("table")
local logwarning=report_process
local resolved={} 
local function logprocess(...)
 if trace_steps then
  registermessage(...)
  if trace_steps=="silent" then
   return
  end
 end
 report_process(...)
end
local sequencelists=setmetatableindex(function(t,font)
 local sequences=fontdata[font].resources.sequences
 if not sequences or not next(sequences) then
  sequences=false
 end
 t[font]=sequences
 return sequences
end)
do 
 local autofeatures=fonts.analyzers.features
 local featuretypes=otf.tables.featuretypes
 local defaultscript=otf.features.checkeddefaultscript
 local defaultlanguage=otf.features.checkeddefaultlanguage
 local wildcard="*"
 local default="dflt"
 local function initialize(sequence,script,language,enabled,autoscript,autolanguage)
  local features=sequence.features
  if features then
   local order=sequence.order
   if order then
    local featuretype=featuretypes[sequence.type or "unknown"]
    for i=1,#order do
     local kind=order[i]
     local valid=enabled[kind]
     if valid then
      local scripts=features[kind]
      local languages=scripts and (
       scripts[script] or
       scripts[wildcard] or
       (autoscript and defaultscript(featuretype,autoscript,scripts))
      )
      local enabled=languages and (
       languages[language] or
       languages[wildcard] or
       (autolanguage and defaultlanguage(featuretype,autolanguage,languages))
      )
      if enabled then
       return { valid,autofeatures[kind] or false,sequence,kind }
      end
     end
    end
   else
   end
  end
  return false
 end
 function otf.dataset(tfmdata,font) 
  local shared=tfmdata.shared
  local properties=tfmdata.properties
  local language=properties.language or "dflt"
  local script=properties.script   or "dflt"
  local enabled=shared.features
  local autoscript=enabled and enabled.autoscript
  local autolanguage=enabled and enabled.autolanguage
  local res=resolved[font]
  if not res then
   res={}
   resolved[font]=res
  end
  local rs=res[script]
  if not rs then
   rs={}
   res[script]=rs
  end
  local rl=rs[language]
  if not rl then
   rl={
   }
   rs[language]=rl
   local sequences=tfmdata.resources.sequences
   if sequences then
    for s=1,#sequences do
     local v=enabled and initialize(sequences[s],script,language,enabled,autoscript,autolanguage)
     if v then
      rl[#rl+1]=v
     end
    end
   end
  end
  return rl
 end
end
local function report_disc(what,n)
 report_run("%s: %s > %s",what,n,languages.serializediscretionary(n))
end
local function kernrun(disc,k_run,font,attr,...)
 if trace_kernruns then
  report_disc("kern",disc)
 end
 local prev,next=getboth(disc)
 local nextstart=next
 local done=false
 local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
 local prevmarks=prev
 while prevmarks do
  local char=ischar(prevmarks,font)
  if char and marks[char] then
   prevmarks=getprev(prevmarks)
  else
   break
  end
 end
 if prev and not ischar(prev,font) then  
  prev=false
 end
 if next and not ischar(next,font) then  
  next=false
 end
 if pre then
  if k_run(pre,"injections",nil,font,attr,...) then
   done=true
  end
  if prev then
   setlink(prev,pre)
   if k_run(prevmarks,"preinjections",pre,font,attr,...) then 
    done=true
   end
   setprev(pre)
   setlink(prev,disc)
  end
 end
 if post then
  if k_run(post,"injections",nil,font,attr,...) then
   done=true
  end
  if next then
   setlink(posttail,next)
   if k_run(posttail,"postinjections",next,font,attr,...) then
    done=true
   end
   setnext(posttail)
   setlink(disc,next)
  end
 end
 if replace then
  if k_run(replace,"injections",nil,font,attr,...) then
   done=true
  end
  if prev then
   setlink(prev,replace)
   if k_run(prevmarks,"replaceinjections",replace,font,attr,...) then 
    done=true
   end
   setprev(replace)
   setlink(prev,disc)
  end
  if next then
   setlink(replacetail,next)
   if k_run(replacetail,"replaceinjections",next,font,attr,...) then
    done=true
   end
   setnext(replacetail)
   setlink(disc,next)
  end
 elseif prev and next then
  setlink(prev,next)
  if k_run(prevmarks,"emptyinjections",next,font,attr,...) then
   done=true
  end
  setlink(prev,disc,next)
 end
 if done and trace_testruns then
  report_disc("done",disc)
 end
 return nextstart,done
end
local function comprun(disc,c_run,...) 
 if trace_compruns then
  report_disc("comp",disc)
 end
 local pre,post,replace=getdisc(disc)
 local renewed=false
 if pre then
  sweepnode=disc
  sweeptype="pre" 
  local new,done=c_run(pre,...)
  if done then
   pre=new
   renewed=true
  end
 end
 if post then
  sweepnode=disc
  sweeptype="post"
  local new,done=c_run(post,...)
  if done then
   post=new
   renewed=true
  end
 end
 if replace then
  sweepnode=disc
  sweeptype="replace"
  local new,done=c_run(replace,...)
  if done then
   replace=new
   renewed=true
  end
 end
 sweepnode=nil
 sweeptype=nil
 if renewed then
  if trace_testruns then
   report_disc("done",disc)
  end
  setdisc(disc,pre,post,replace)
 end
 return getnext(disc),renewed
end
local function testrun(disc,t_run,c_run,...)
 if trace_testruns then
  report_disc("test",disc)
 end
 local prev,next=getboth(disc)
 if not next then
  return
 end
 local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true)
 local renewed=false
 if post or replace then 
  if post then
   setlink(posttail,next)
  else
   post=next
  end
  if replace then
   setlink(replacetail,next)
  else
   replace=next
  end
  local d_post=t_run(post,next,...)
  local d_replace=t_run(replace,next,...)
  if d_post>0 or d_replace>0 then
   local d=d_replace>d_post and d_replace or d_post
   local head=getnext(disc) 
   local tail=head
   for i=2,d do 
    local nx=getnext(tail)
    local id=getid(nx)
    if id==disc_code then
     head,tail=flattendisk(head,nx)
    elseif id==glyph_code then
     tail=nx
    else
     break
    end
   end
   next=getnext(tail)
   setnext(tail)
   setprev(head)
   local new=copy_node_list(head)
   if posttail then
    setlink(posttail,head)
   else
    post=head
   end
   if replacetail then
    setlink(replacetail,new)
   else
    replace=new
   end
  else
   if posttail then
    setnext(posttail)
   else
    post=nil
   end
   if replacetail then
    setnext(replacetail)
   else
    replace=nil
   end
  end
  setlink(disc,next)
 end
 if trace_testruns then
  report_disc("more",disc)
 end
 if pre then
  sweepnode=disc
  sweeptype="pre"
  local new,ok=c_run(pre,...)
  if ok then
   pre=new
   renewed=true
  end
 end
 if post then
  sweepnode=disc
  sweeptype="post"
  local new,ok=c_run(post,...)
  if ok then
   post=new
   renewed=true
  end
 end
 if replace then
  sweepnode=disc
  sweeptype="replace"
  local new,ok=c_run(replace,...)
  if ok then
   replace=new
   renewed=true
  end
 end
 sweepnode=nil
 sweeptype=nil
 if renewed then
  setdisc(disc,pre,post,replace)
  if trace_testruns then
   report_disc("done",disc)
  end
 end
 return getnext(disc),renewed
end
local nesting=0
local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
 local done=false
 local sweep=sweephead[head]
 local start
 if sweep then
  start=sweep
  sweephead[head]=false
 else
  start=head
 end
 while start do
  local char,id=ischar(start,font)
  if char then
   local a 
   if attr then
    a=getglyphdata(start)
   end
   if not a or (a==attr) then
    local lookupmatch=lookupcache[char]
    if lookupmatch then
     local ok
     head,start,ok=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
     if ok then
      done=true
     end
    end
    if start then
     start=getnext(start)
    end
   else
    start=getnext(start)
   end
  elseif char==false then
   return head,done
  elseif sweep then
   return head,done
  else
   start=getnext(start)
  end
 end
 return head,done
end
local function t_run_single(start,stop,font,attr,lookupcache)
 local lastd=nil
 while start~=stop do
  local char=ischar(start,font)
  if char then
   local a 
   if attr then
    a=getglyphdata(start)
   end
   local startnext=getnext(start)
   if not a or (a==attr) then
    local lookupmatch=lookupcache[char]
    if lookupmatch then
     local s=startnext
     local ss=nil
     local sstop=s==stop
     if not s then
      s=ss
      ss=nil
     end
     while getid(s)==disc_code do
      ss=getnext(s)
      s=getreplace(s)
      if not s then
       s=ss
       ss=nil
      end
     end
     local l=nil
     local d=0
     while s do
      local char=ischar(s,font)
      if char then
       local lg=not tonumber(lookupmatch) and lookupmatch[char]
       if lg then
        if sstop then
         d=1
        elseif d>0 then
         d=d+1
        end
        l=lg
        s=getnext(s)
        sstop=s==stop
        if not s then
         s=ss
         ss=nil
        end
        while getid(s)==disc_code do
         ss=getnext(s)
         s=getreplace(s)
         if not s then
          s=ss
          ss=nil
         end
        end
        lookupmatch=lg
       else
        break
       end
      else
       break
      end
     end
     if l and (tonumber(l) or l.ligature) then 
      lastd=d
     end
    else
    end
   else
   end
   if lastd then
    return lastd
   end
   start=startnext
  else
   break
  end
 end
 return 0
end
local function k_run_single(sub,injection,last,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
 local a 
 if attr then
  a=getglyphdata(sub)
 end
 if not a or (a==attr) then
  for n in nextnode,sub do 
   if n==last then
    break
   end
   local char=ischar(n,font)
   if char then
    local lookupmatch=lookupcache[char]
    if lookupmatch then
     local h,d,ok=handler(sub,n,dataset,sequence,lookupmatch,rlmode,skiphash,step,injection)
     if ok then
      return true
     end
    end
   end
  end
 end
end
local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
 local done=false
 local sweep=sweephead[head]
 local start
 if sweep then
  start=sweep
  sweephead[head]=false
 else
  start=head
 end
 while start do
  local char=ischar(start,font)
  if char then
   local a 
   if attr then
    a=getglyphdata(start)
   end
   if not a or (a==attr) then
    for i=1,nofsteps do
     local step=steps[i]
     local lookupcache=step.coverage
     local lookupmatch=lookupcache[char]
     if lookupmatch then
      local ok
      head,start,ok=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
      if ok then
       done=true
       break
      elseif not start then
       break
      end
     end
    end
    if start then
     start=getnext(start)
    end
   else
    start=getnext(start)
   end
  elseif char==false then
   return head,done
  elseif sweep then
   return head,done
  else
   start=getnext(start)
  end
 end
 return head,done
end
local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
 local lastd=nil
 while start~=stop do
  local char=ischar(start,font)
  if char then
   local a 
   if attr then
    a=getglyphdata(start)
   end
   local startnext=getnext(start)
   if not a or (a==attr) then
    for i=1,nofsteps do
     local step=steps[i]
     local lookupcache=step.coverage
     local lookupmatch=lookupcache[char]
     if lookupmatch then
      local s=startnext
      local ss=nil
      local sstop=s==stop
      if not s then
       s=ss
       ss=nil
      end
      while getid(s)==disc_code do
       ss=getnext(s)
       s=getreplace(s)
       if not s then
        s=ss
        ss=nil
       end
      end
      local l=nil
      local d=0
      while s do
       local char=ischar(s)
       if char then
        local lg=not tonumber(lookupmatch) and lookupmatch[char]
        if lg then
         if sstop then
          d=1
         elseif d>0 then
          d=d+1
         end
         l=lg
         s=getnext(s)
         sstop=s==stop
         if not s then
          s=ss
          ss=nil
         end
         while getid(s)==disc_code do
          ss=getnext(s)
          s=getreplace(s)
          if not s then
           s=ss
           ss=nil
          end
         end
         lookupmatch=lg
        else
         break
        end
       else
        break
       end
      end
      if l and (tonumber(l) or l.ligature) then
       lastd=d
      end
     end
    end
   else
   end
   if lastd then
    return lastd
   end
   start=startnext
  else
   break
  end
 end
 return 0
end
local function k_run_multiple(sub,injection,last,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
 local a 
 if attr then
  a=getglyphdata(sub)
 end
 if not a or (a==attr) then
  for n in nextnode,sub do 
   if n==last then
    break
   end
   local char=ischar(n)
   if char then
    for i=1,nofsteps do
     local step=steps[i]
     local lookupcache=step.coverage
     local lookupmatch=lookupcache[char]
     if lookupmatch then
      local h,d,ok=handler(sub,n,dataset,sequence,lookupmatch,rlmode,skiphash,step,injection) 
      if ok then
       return true
      end
     end
    end
   end
  end
 end
end
local txtdirstate,pardirstate  do 
 local getdirection=nuts.getdirection
 txtdirstate=function(start,stack,top,rlparmode)
  local dir,pop=getdirection(start)
  if pop then
   if top==1 then
    return 0,rlparmode
   else
    top=top-1
    if stack[top]==righttoleft_code then
     return top,-1
    else
     return top,1
    end
   end
  elseif dir==lefttoright_code then
   top=top+1
   stack[top]=lefttoright_code
   return top,1
  elseif dir==righttoleft_code then
   top=top+1
   stack[top]=righttoleft_code
   return top,-1
  else
   return top,rlparmode
  end
 end
 pardirstate=function(start)
  local dir=getdirection(start)
  if dir==lefttoright_code then
   return 1,1
  elseif dir==righttoleft_code then
   return -1,-1
  else
   return 0,0
  end
 end
end
otf.helpers=otf.helpers or {}
otf.helpers.txtdirstate=txtdirstate
otf.helpers.pardirstate=pardirstate
do
 local fastdisc=true
 local testdics=false
 directives.register("otf.fastdisc",function(v) fastdisc=v end)
 local otfdataset=nil 
 local getfastdisc={ __index=function(t,k)
  local v=usesfont(k,currentfont)
  t[k]=v
  return v
 end }
 local getfastspace={ __index=function(t,k)
  local v=isspace(k,threshold) or false
  t[k]=v
  return v
 end }
 function otf.featuresprocessor(head,font,attr,direction,n)
  local sequences=sequencelists[font] 
  nesting=nesting+1
  if nesting==1 then
   currentfont=font
   tfmdata=fontdata[font]
   descriptions=tfmdata.descriptions 
   characters=tfmdata.characters   
   local resources=tfmdata.resources
   marks=resources.marks
   classes=resources.classes
   threshold,
   factor=getthreshold(font)
   checkmarks=tfmdata.properties.checkmarks
   if not otfdataset then
    otfdataset=otf.dataset
   end
   discs=fastdisc and n and n>1 and setmetatable({},getfastdisc) 
   spaces=setmetatable({},getfastspace)
  elseif currentfont~=font then
   report_warning("nested call with a different font, level %s, quitting",nesting)
   nesting=nesting-1
   return head,false
  end
  if trace_steps then
   checkstep(head)
  end
  local initialrl=0
  if getid(head)==par_code and startofpar(head) then
   initialrl=pardirstate(head)
  elseif direction==righttoleft_code then
   initialrl=-1
  end
  local datasets=otfdataset(tfmdata,font,attr)
  local dirstack={ nil } 
  sweephead={}
  for s=1,#datasets do
   local dataset=datasets[s]
   local attribute=dataset[2]
   local sequence=dataset[3] 
   local rlparmode=initialrl
   local topstack=0
   local typ=sequence.type
   local gpossing=typ=="gpos_single" or typ=="gpos_pair" 
   local forcetestrun=typ=="gsub_ligature" 
   local handler=handlers[typ] 
   local steps=sequence.steps
   local nofsteps=sequence.nofsteps
   local skiphash=sequence.skiphash
   if not steps then
    local h,ok=handler(head,dataset,sequence,initialrl,font,attr)
    if h and h~=head then
     head=h
    end
   elseif typ=="gsub_reversecontextchain" then
    local start=find_node_tail(head)
    local rlmode=0 
    local merged=steps.merged
    while start do
     local char=ischar(start,font)
     if char then
      local m=merged[char]
      if m then
       local a 
       if attr then
        a=getglyphdata(start)
       end
       if not a or (a==attr) then
        for i=m[1],m[2] do
         local step=steps[i]
         local lookupcache=step.coverage
         local lookupmatch=lookupcache[char]
         if lookupmatch then
          local ok
          head,start,ok=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
          if ok then
           break
          end
         end
        end
        if start then
         start=getprev(start)
        end
       else
        start=getprev(start)
       end
      else
       start=getprev(start)
      end
     else
      start=getprev(start)
     end
    end
   else
    local start=head
    local rlmode=initialrl
    if nofsteps==1 then 
     local step=steps[1]
     local lookupcache=step.coverage
     while start do
      local char,id=ischar(start,font)
      if char then
       if skiphash and skiphash[char] then 
        start=getnext(start)
       else
        local lookupmatch=lookupcache[char]
        if lookupmatch then
         local a 
         if attr then
          if getglyphdata(start)==attr and (not attribute or getstate(start,attribute)) then
           a=true
          end
         elseif not attribute or getstate(start,attribute) then
          a=true
         end
         if a then
          local ok,df
          head,start,ok,df=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
          if df then
          elseif start then
           start=getnext(start)
          end
         else
          start=getnext(start)
         end
        else
           start=getnext(start)
        end
       end
      elseif char==false or id==glue_code then
       start=getnext(start)
      elseif id==disc_code then
       if not discs or discs[start]==true then
        local ok
        if gpossing then
         start,ok=kernrun(start,k_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
        elseif forcetestrun then
         start,ok=testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
        else
         start,ok=comprun(start,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler)
        end
       else
        start=getnext(start)
       end
      elseif id==math_code then
       start=getnext(endofmath(start))
      elseif id==dir_code then
       topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
       start=getnext(start)
      else
       start=getnext(start)
      end
     end
    else
     local merged=steps.merged
     while start do
      local char,id=ischar(start,font)
      if char then
       if skiphash and skiphash[char] then 
        start=getnext(start)
       else
        local m=merged[char]
        if m then
         local a 
         if attr then
          if getglyphdata(start)==attr and (not attribute or getstate(start,attribute)) then
           a=true
          end
         elseif not attribute or getstate(start,attribute) then
          a=true
         end
         if a then
          local ok,df
          for i=m[1],m[2] do
           local step=steps[i]
           local lookupcache=step.coverage
           local lookupmatch=lookupcache[char]
           if lookupmatch then
            head,start,ok,df=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
            if df then
             break
            elseif ok then
             break
            elseif not start then
             break
            end
           end
          end
          if df then
          elseif start then
           start=getnext(start)
          end
         else
          start=getnext(start)
         end
        else
         start=getnext(start)
        end
       end
      elseif char==false or id==glue_code then
       start=getnext(start)
      elseif id==disc_code then
       if not discs or discs[start]==true then
        local ok
        if gpossing then
         start,ok=kernrun(start,k_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
        elseif forcetestrun then
         start,ok=testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
        else
         start,ok=comprun(start,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler)
        end
       else
        start=getnext(start)
       end
      elseif id==math_code then
       start=getnext(endofmath(start))
      elseif id==dir_code then
       topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
       start=getnext(start)
      else
       start=getnext(start)
      end
     end
    end
   end
   if trace_steps then 
    registerstep(head)
   end
  end
  nesting=nesting-1
  return head
 end
 function otf.datasetpositionprocessor(head,font,direction,dataset)
  currentfont=font
  tfmdata=fontdata[font]
  descriptions=tfmdata.descriptions 
  characters=tfmdata.characters   
  local resources=tfmdata.resources
  marks=resources.marks
  classes=resources.classes
  threshold,
  factor=getthreshold(font)
  checkmarks=tfmdata.properties.checkmarks
  if type(dataset)=="number" then
   dataset=otfdataset(tfmdata,font,0)[dataset]
  end
  local sequence=dataset[3] 
  local typ=sequence.type
  local handler=handlers[typ] 
  local steps=sequence.steps
  local nofsteps=sequence.nofsteps
  local done=false
  local dirstack={ nil } 
  local start=head
  local initialrl=(direction==righttoleft_code) and -1 or 0
  local rlmode=initialrl
  local rlparmode=initialrl
  local topstack=0
  local merged=steps.merged
  local position=0
  while start do
   local char,id=ischar(start,font)
   if char then
    position=position+1
    local m=merged[char]
    if m then
     if skiphash and skiphash[char] then 
      start=getnext(start)
     else
      for i=m[1],m[2] do
       local step=steps[i]
       local lookupcache=step.coverage
       local lookupmatch=lookupcache[char]
       if lookupmatch then
        local ok
        head,start,ok=handler(head,start,dataset,sequence,lookupmatch,rlmode,skiphash,step)
        if ok then
         break
        elseif not start then
         break
        end
       end
      end
      if start then
       start=getnext(start)
      end
     end
    else
     start=getnext(start)
    end
   elseif char==false or id==glue_code then
    start=getnext(start)
   elseif id==math_code then
    start=getnext(endofmath(start))
   elseif id==dir_code then
    topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
    start=getnext(start)
   else
    start=getnext(start)
   end
  end
  return head
 end
end
do
 local plugins={}
 otf.plugins=plugins
 local report=logs.reporter("fonts")
 local warned=false
 local okay={ text=true }
 function otf.registerplugin(name,f)
  if type(name)=="string" and type(f)=="function" then
   plugins[name]={ name,f }
   if okay[name] then
   else
    report("plugin %a has been loaded, please be aware of possible side effects",name)
    if not warned then
     if logs.pushtarget then
      logs.pushtarget("log")
     end
     report("Plugins are not officially supported unless stated otherwise. This is because")
     report("they bypass the regular font handling and therefore some features in ConTeXt")
     report("(especially those related to fonts) might not work as expected or might not work")
     report("at all. Some plugins are for testing and development only and might change")
     report("whenever we feel the need for it.")
     report()
     if logs.poptarget then
      logs.poptarget()
     end
     warned=true
    end
   end
  end
 end
 function otf.plugininitializer(tfmdata,value)
  if type(value)=="string" then
   tfmdata.shared.plugin=plugins[value]
  end
 end
 function otf.pluginprocessor(head,font,dynamic,direction) 
  local s=fontdata[font].shared
  local p=s and s.plugin
  if p then
   if trace_plugins then
    report_process("applying plugin %a",p[1])
   end
   return p[2](head,font,dynamic,direction)
  else
   return head,false
  end
 end
end
function otf.featuresinitializer(tfmdata,value)
end
registerotffeature {
 name="features",
 description="features",
 default=true,
 initializers={
  position=1,
  node=otf.featuresinitializer,
  plug=otf.plugininitializer,
 },
 processors={
  node=otf.featuresprocessor,
  plug=otf.pluginprocessor,
 }
}
local function markinitializer(tfmdata,value)
 local properties=tfmdata.properties
 properties.checkmarks=value
end
registerotffeature {
 name="checkmarks",
 description="check mark widths",
 default=true,
 initializers={
  node=markinitializer,
 },
}
otf.handlers=handlers
if context then
 return
else
end
local setspacekerns=nodes.injections.setspacekerns if not setspacekerns then os.exit() end
local tag="kern"
 function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr)
  local shared=fontdata[font].shared
  local features=shared and shared.features
  local enabled=features and features.spacekern and features[tag]
  if enabled then
   setspacekerns(font,sequence)
  end
  return head,enabled
 end
local function hasspacekerns(data)
 local resources=data.resources
 local sequences=resources.sequences
 local validgpos=resources.features.gpos
 if validgpos and sequences then
  for i=1,#sequences do
   local sequence=sequences[i]
   local steps=sequence.steps
   if steps and sequence.features[tag] then
    local kind=sequence.type
    if kind=="gpos_pair" or kind=="gpos_single" then
     for i=1,#steps do
      local step=steps[i]
      local coverage=step.coverage
      local rules=step.rules
      if rules then
      elseif not coverage then
      elseif kind=="gpos_single" then
      elseif kind=="gpos_pair" then
       local format=step.format
       if format=="move" or format=="kern" then
        local kerns=coverage[32]
        if kerns then
         return true
        end
        for k,v in next,coverage do
         if v[32] then
          return true
         end
        end
       elseif format=="pair" then
        local kerns=coverage[32]
        if kerns then
         for k,v in next,kerns do
          local one=v[1]
          if one and one~=true then
           return true
          end
         end
        end
        for k,v in next,coverage do
         local kern=v[32]
         if kern then
          local one=kern[1]
          if one and one~=true then
           return true
          end
         end
        end
       end
      end
     end
    end
   end
  end
 end
 return false
end
otf.readers.registerextender {
 name="spacekerns",
 action=function(data)
  data.properties.hasspacekerns=hasspacekerns(data)
 end
}
local function spaceinitializer(tfmdata,value) 
 local resources=tfmdata.resources
 local spacekerns=resources and resources.spacekerns
 if value and spacekerns==nil then
  local rawdata=tfmdata.shared and tfmdata.shared.rawdata
  local properties=rawdata.properties
  if properties and properties.hasspacekerns then
   local sequences=resources.sequences
   local validgpos=resources.features.gpos
   if validgpos and sequences then
    local left={}
    local right={}
    local last=0
    local feat=nil
    for i=1,#sequences do
     local sequence=sequences[i]
     local steps=sequence.steps
     if steps then
      local kern=sequence.features[tag]
      if kern then
       local kind=sequence.type
       if kind=="gpos_pair" or kind=="gpos_single" then
        if feat then
         for script,languages in next,kern do
          local f=feat[script]
          if f then
           for l in next,languages do
            f[l]=true
           end
          else
           feat[script]=languages
          end
         end
        else
         feat=kern
        end
        for i=1,#steps do
         local step=steps[i]
         local coverage=step.coverage
         local rules=step.rules
         if rules then
         elseif not coverage then
         elseif kind=="gpos_single" then
         elseif kind=="gpos_pair" then
          local format=step.format
          if format=="move" or format=="kern" then
           local kerns=coverage[32]
           if kerns then
            for k,v in next,kerns do
             right[k]=v
            end
           end
           for k,v in next,coverage do
            local kern=v[32]
            if kern then
             left[k]=kern
            end
           end
          elseif format=="pair" then
           local kerns=coverage[32]
           if kerns then
            for k,v in next,kerns do
             local one=v[1]
             if one and one~=true then
              right[k]=one[3]
             end
            end
           end
           for k,v in next,coverage do
            local kern=v[32]
            if kern then
             local one=kern[1]
             if one and one~=true then
              left[k]=one[3]
             end
            end
           end
          end
         end
        end
        last=i
       end
      else
      end
     end
    end
    left=next(left)  and left  or false
    right=next(right) and right or false
    if left or right then
     spacekerns={
      left=left,
      right=right,
     }
     if last>0 then
      local triggersequence={
       features={ [tag]=feat or { dflt={ dflt=true,} } },
       flags=noflags,
       name="trigger_space_kerns",
       order={ tag },
       type="trigger_space_kerns",
       left=left,
       right=right,
      }
      insert(sequences,last,triggersequence)
     end
    end
   end
  end
  resources.spacekerns=spacekerns
 end
 return spacekerns
end
registerotffeature {
 name="spacekern",
 description="space kern injection",
 default=true,
 initializers={
  node=spaceinitializer,
 },
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ots”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-osd” a67b6fb465e7a8b9ecf7c6bbf8dfda03] ---

if not modules then modules={} end modules ['font-osd']={ 
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Kai Eigner, TAT Zetwerk / Hans Hagen, PRAGMA ADE",
 copyright="TAT Zetwerk / PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local insert,remove,imerge,copy,tohash=table.insert,table.remove,table.imerge,table.copy,table.tohash
local next,type,rawget=next,type,rawget
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
local report=logs.reporter("otf","devanagari")
fonts=fonts       or {}
fonts.analyzers=fonts.analyzers   or {}
fonts.analyzers.methods=fonts.analyzers.methods or { node={ otf={} } }
local otf=fonts.handlers.otf
local handlers=otf.handlers
local methods=fonts.analyzers.methods
local otffeatures=fonts.constructors.features.otf
local registerotffeature=otffeatures.register
local trace_steps=false
local nuts=nodes.nuts
local getnext=nuts.getnext
local getprev=nuts.getprev
local getboth=nuts.getboth
local getid=nuts.getid
local getchar=nuts.getchar
local getfont=nuts.getfont
local getsubtype=nuts.getsubtype
local setlink=nuts.setlink
local setnext=nuts.setnext
local setprev=nuts.setprev
local setchar=nuts.setchar
local getprop=nuts.getprop
local setprop=nuts.setprop
local getstate=nuts.getstate
local setstate=nuts.setstate
local ischar=nuts.ischar
local insertnodeafter=nuts.insertafter
local copy_node=nuts.copy
local remove_node=nuts.remove
local flushlist=nuts.flushlist
local flushnode=nuts.flushnode
local copyinjection=nodes.injections.copy 
local unsetvalue=attributes.unsetvalue
local fontdata=fonts.hashes.identifiers
local a_syllabe="syllable"  
local a_reordered="reordered" 
local dotted_circle=0x25CC
local c_nbsp=0x00A0
local c_zwnj=0x200C
local c_zwj=0x200D
local states=fonts.analyzers.states 
local s_rphf=states.rphf
local s_half=states.half
local s_pref=states.pref
local s_blwf=states.blwf
local s_pstf=states.pstf
local s_init=states.init
local replace_all_nbsp=nil
replace_all_nbsp=function(head) 
 replace_all_nbsp=typesetters and typesetters.characters and typesetters.characters.replacenbspaces or function(head)
  return head
 end
 return replace_all_nbsp(head)
end
local processcharacters=nil
local logprocess=nil
if context then
 local fontprocesses=fonts.hashes.processes
 local tracers=nodes.tracers
 local registermessage=(tracers and tracers.steppers.message) or function() end
 function processcharacters(head,font)
  local processors=fontprocesses[font]
  for i=1,#processors do
   head=processors[i](head,font,0)
  end
  return head
 end
 trackers.register("otf.steps",function(v) trace_steps=v end)
 logprocess=function(str)
  if trace_steps then
   registermessage("devanagari %s",str)
   if trace_steps=="silent" then
    return
   end
  end
  report(str)
 end
else
 function processcharacters(head,font)
  local processors=fontdata[font].shared.processes
  for i=1,#processors do
   head=processors[i](head,font,0)
  end
  return head
 end
 logprocess=function(str)
 end
end
local indicgroups=characters and characters.indicgroups
if not indicgroups and characters then
 local indic={
  c={},
  i={},
  d={},
  m={},
  s={},
  o={},
 }
 local indicmarks={
  l={},
  t={},
  b={},
  r={},
  s={},
 }
 local indicclasses={
  nukta={},
  halant={},
  ra={},
  anudatta={},
 }
 local indicorders={
  bp={},
  ap={},
  bs={},
  as={},
  bh={},
  ah={},
  bm={},
  am={},
 }
 for k,v in next,characters.data do
  local i=v.indic
  if i then
   indic[i][k]=true
   i=v.indicmark
   if i then
    if i=="s" then
     local s=v.specials
     indicmarks[i][k]={ s[2],s[3] }
    else
     indicmarks[i][k]=true
    end
   end
   i=v.indicclass
   if i then
    indicclasses[i][k]=true
   end
   i=v.indicorder
   if i then
    indicorders[i][k]=true
   end
  end
 end
 indicgroups={
  consonant=indic.c,
  independent_vowel=indic.i,
  dependent_vowel=indic.d,
  vowel_modifier=indic.m,
  stress_tone_mark=indic.s,
  pre_mark=indicmarks.l,
  above_mark=indicmarks.t,
  below_mark=indicmarks.b,
  post_mark=indicmarks.r,
  twopart_mark=indicmarks.s,
  nukta=indicclasses.nukta,
  halant=indicclasses.halant,
  ra=indicclasses.ra,
  anudatta=indicclasses.anudatta,
  before_postscript=indicorders.bp,
  after_postscript=indicorders.ap,
  before_half=indicorders.bh,
  after_half=indicorders.ah,
  before_subscript=indicorders.bs,
  after_subscript=indicorders.as,
  before_main=indicorders.bm,
  after_main=indicorders.am,
 }
 indic=nil
 indicmarks=nil
 indicclasses=nil
 indicorders=nil
 characters.indicgroups=indicgroups
end
local consonant=indicgroups.consonant
local independent_vowel=indicgroups.independent_vowel
local dependent_vowel=indicgroups.dependent_vowel
local vowel_modifier=indicgroups.vowel_modifier
local stress_tone_mark=indicgroups.stress_tone_mark
local pre_mark=indicgroups.pre_mark
local above_mark=indicgroups.above_mark
local below_mark=indicgroups.below_mark
local post_mark=indicgroups.post_mark
local twopart_mark=indicgroups.twopart_mark
local nukta=indicgroups.nukta
local halant=indicgroups.halant
local ra=indicgroups.ra
local anudatta=indicgroups.anudatta
local before_postscript=indicgroups.before_postscript
local after_postscript=indicgroups.after_postscript
local before_half=indicgroups.before_half
local after_half=indicgroups.after_half
local before_subscript=indicgroups.before_subscript
local after_subscript=indicgroups.after_subscript
local before_main=indicgroups.before_main
local after_main=indicgroups.after_main
local mark_pre_above_below_post=table.merged (
 pre_mark,
 above_mark,
 below_mark,
 post_mark
)
local mark_above_below_post=table.merged (
 above_mark,
 below_mark,
 post_mark
)
local devanagarihash=table.setmetatableindex(function(t,k)
 local v=fontdata[k].resources.devanagari or false
 t[k]=v
 return v
end)
local zw_char={ 
 [c_zwnj]=true,
 [c_zwj ]=true,
}
local dflt_true={
 dflt=true,
}
local two_defaults={}
local one_defaults={}
local false_flags={ false,false,false,false }
local sequence_reorder_matras={
 features={ dv01=two_defaults },
 flags=false_flags,
 name="dv01_reorder_matras",
 order={ "dv01" },
 type="devanagari_reorder_matras",
 nofsteps=1,
 steps={
  {
   coverage=pre_mark,
  }
 }
}
local sequence_reorder_reph={
 features={ dv02=two_defaults },
 flags=false_flags,
 name="dv02_reorder_reph",
 order={ "dv02" },
 type="devanagari_reorder_reph",
 nofsteps=1,
 steps={
  {
   coverage={},
  }
 }
}
local sequence_reorder_pre_base_reordering_consonants={
 features={ dv03=one_defaults },
 flags=false_flags,
 name="dv03_reorder_pre_base_reordering_consonants",
 order={ "dv03" },
 type="devanagari_reorder_pre_base_reordering_consonants",
 nofsteps=1,
 steps={
  {
   coverage={},
  }
 }
}
local sequence_remove_joiners={
 features={ dv04=one_defaults },
 flags=false_flags,
 name="dv04_remove_joiners",
 order={ "dv04" },
 type="devanagari_remove_joiners",
 nofsteps=1,
 steps={
  {
     coverage=zw_char,
  },
 }
}
local basic_shaping_forms={
 akhn=true,
 blwf=true,
 cjct=true,
 half=true,
 nukt=true,
 pref=true,
 pstf=true,
 rkrf=true,
 rphf=true,
 vatu=true,
 locl=true,
}
local valid={
 abvs=true,
 akhn=true,
 blwf=true,
 calt=true,
 cjct=true,
 half=true,
 haln=true,
 nukt=true,
 pref=true,
 pres=true,
 pstf=true,
 psts=true,
 rkrf=true,
 rphf=true,
 vatu=true,
 pres=true,
 abvs=true,
 blws=true,
 psts=true,
 haln=true,
 calt=true,
 locl=true,
}
local scripts={}
local scripts_one={ "deva","mlym","beng","gujr","guru","knda","orya","taml","telu" }
local scripts_two={ "dev2","mlm2","bng2","gjr2","gur2","knd2","ory2","tml2","tel2" }
local nofscripts=#scripts_one
for i=1,nofscripts do
 local one=scripts_one[i]
 local two=scripts_two[i]
 scripts[one]=true
 scripts[two]=true
 two_defaults[two]=dflt_true
 one_defaults[one]=dflt_true
 one_defaults[two]=dflt_true
end
local function valid_one(s) for i=1,nofscripts do if s[scripts_one[i]] then return true end end end
local function valid_two(s) for i=1,nofscripts do if s[scripts_two[i]] then return true end end end
local function initializedevanagi(tfmdata)
 local script,language=otf.scriptandlanguage(tfmdata,attr) 
 if scripts[script] then
  local resources=tfmdata.resources
  local devanagari=resources.devanagari
  if not devanagari then
   report("adding features to font")
   local gsubfeatures=resources.features.gsub
   local sequences=resources.sequences
   local sharedfeatures=tfmdata.shared.features
   gsubfeatures["dv01"]=two_defaults 
   gsubfeatures["dv02"]=two_defaults 
   gsubfeatures["dv03"]=one_defaults 
   gsubfeatures["dv04"]=one_defaults
   local reorder_pre_base_reordering_consonants=copy(sequence_reorder_pre_base_reordering_consonants)
   local reorder_reph=copy(sequence_reorder_reph)
   local reorder_matras=copy(sequence_reorder_matras)
   local remove_joiners=copy(sequence_remove_joiners)
   local lastmatch=0
   for s=1,#sequences do 
    local features=sequences[s].features
    if features then
     for k,v in next,features do
      if k=="locl" then
       local steps=sequences[s].steps
       local nofsteps=sequences[s].nofsteps
       for i=1,nofsteps do
        local step=steps[i]
        local coverage=step.coverage
        if coverage then
         for k,v in next,pre_mark do
          local locl=coverage[k]
          if locl then
           if #locl>0 then
            for j=1,#locl do
             local ck=locl[j]
             local f=ck[4]
             local chainlookups=ck[6]
             if chainlookups then
              local chainlookup=chainlookups[f]
              for j=1,#chainlookup do
               local chainstep=chainlookup[j]
               local steps=chainstep.steps
               local nofsteps=chainstep.nofsteps
               for i=1,nofsteps do
                local step=steps[i]
                local coverage=step.coverage
                if coverage then
                 locl=coverage[k]
                end
               end
              end
             end
            end
           else
           end
           if locl then
            reorder_matras.steps[1].coverage[locl]=true
           end
          end
         end
        end
       end
      end
      if basic_shaping_forms[k] then
       lastmatch=lastmatch+1
       if s~=lastmatch then
        insert(sequences,lastmatch,remove(sequences,s))
       end
      end
     end
    end
   end
   local insertindex=lastmatch+1
   if tfmdata.properties.language then
    dflt_true[tfmdata.properties.language]=true
   end
   insert(sequences,insertindex,reorder_pre_base_reordering_consonants)
   insert(sequences,insertindex,reorder_reph)
   insert(sequences,insertindex,reorder_matras)
   insert(sequences,insertindex,remove_joiners)
   local blwfcache={}
   local vatucache={}
   local pstfcache={}
   local seqsubset={}
   local rephstep={ coverage={} } 
   local devanagari={
    reph=false,
    vattu=false,
    blwfcache=blwfcache,
    vatucache=vatucache,
    pstfcache=pstfcache,
    seqsubset=seqsubset,
    reorderreph=rephstep,
   }
   reorder_reph.steps={ rephstep }
   local pre_base_reordering_consonants={}
   reorder_pre_base_reordering_consonants.steps[1].coverage=pre_base_reordering_consonants
   resources.devanagari=devanagari
   for s=1,#sequences do
    local sequence=sequences[s]
    local steps=sequence.steps
    local nofsteps=sequence.nofsteps
    local features=sequence.features
    local has_rphf=features.rphf
    local has_blwf=features.blwf
    local has_vatu=features.vatu
    local has_pstf=features.pstf
    if has_rphf and has_rphf[script] then
     devanagari.reph=true
    elseif (has_blwf and has_blwf[script]) or (has_vatu and has_vatu[script]) then
     devanagari.vattu=true
     for i=1,nofsteps do
      local step=steps[i]
      local coverage=step.coverage
      if coverage then
       for k,v in next,coverage do
        for h,w in next,halant do
         if v[h] and not blwfcache[k] then
          blwfcache[k]=v
         end
         if has_vatu and has_vatu[script] and not vatucache[k] then
          vatucache[k]=v
         end
        end
       end
      end
     end
    elseif has_pstf and has_pstf[script] then
     for i=1,nofsteps do
      local step=steps[i]
      local coverage=step.coverage
      if coverage then
       for k,v in next,coverage do
        if not pstfcache[k] then
         pstfcache[k]=v
        end
       end
       for k,v in next,ra do
        local r=coverage[k]
        if r then
         local found=false
         if #r>0 then
          for j=1,#r do
           local ck=r[j]
           local f=ck[4]
           local chainlookups=ck[6]
           if chainlookups then
            local chainlookup=chainlookups[f]
            if chainlookup then
             for j=1,#chainlookup do
              local chainstep=chainlookup[j]
              local steps=chainstep.steps
              local nofsteps=chainstep.nofsteps
              for i=1,nofsteps do
               local step=steps[i]
               local coverage=step.coverage
               if coverage then
                local h=coverage[k]
                if h then
                 for k,v in next,h do
                  if v then
                   found=tonumber(v) or v.ligature
                   if found then
                    pre_base_reordering_consonants[found]=true
                    break
                   end
                  end
                 end
                 if found then
                  break
                 end
                end
               end
              end
             end
            end
           end
          end
         else
          for k,v in next,r do
           if v then
            found=tonumber(v) or v.ligature
            if found then
             pre_base_reordering_consonants[found]=true
             break
            end
           end
          end
         end
         if found then
          break
         end
        end
       end
      end
     end
    end
    for kind,spec in next,features do
     if valid[kind] and valid_two(spec)then
      for i=1,nofsteps do
       local step=steps[i]
       local coverage=step.coverage
       if coverage then
        local reph=false
        local base=false
        if kind=="rphf" then
         for k,v in next,ra do
          local r=coverage[k]
          if r then
           base=k
           local h=false
           if #r>0 then
            for j=1,#r do
             local ck=r[j]
             local f=ck[4]
             local chainlookups=ck[6]
             if chainlookups then
              local chainlookup=chainlookups[f]
              for j=1,#chainlookup do
               local chainstep=chainlookup[j]
               local steps=chainstep.steps
               local nofsteps=chainstep.nofsteps
               for i=1,nofsteps do
                local step=steps[i]
                local coverage=step.coverage
                if coverage then
                 local r=coverage[k]
                 if r then
                  for k,v in next,halant do
                   local h=r[k]
                   if h then
                    reph=tonumber(h) or h.ligature or false
                    break
                   end
                  end
                  if h then
                   break
                  end
                 end
                end
               end
              end
             end
            end
           else
            for k,v in next,halant do
             local h=r[k]
             if h then
              reph=tonumber(h) or h.ligature or false
              break
             end
            end
           end
           if reph then
            break
           end
          end
         end
        end
         seqsubset[#seqsubset+1]={ kind,coverage,reph,base }
       end
      end
     end
     if kind=="pref" then
      local steps=sequence.steps
      local nofsteps=sequence.nofsteps
      for i=1,nofsteps do
       local step=steps[i]
       local coverage=step.coverage
       if coverage then
        for k,v in next,halant do
         local h=coverage[k]
         if h then
          local found=false
          if #h>0 then
           for j=1,#h do
            local ck=h[j]
            local f=ck[4]
            local chainlookups=ck[6]
            if chainlookups then
             local chainlookup=chainlookups[f]
             for j=1,#chainlookup do
              local chainstep=chainlookup[j]
              local steps=chainstep.steps
              local nofsteps=chainstep.nofsteps
              for i=1,nofsteps do
               local step=steps[i]
               local coverage=step.coverage
               if coverage then
                local h=coverage[k]
                if h then
                 for k,v in next,h do
                  if v then
                   found=tonumber(v) or v.ligature
                   if found then
                    pre_base_reordering_consonants[found]=true
                    break
                   end
                  end
                 end
                 if found then
                  break
                 end
                end
               end
              end
             end
            end
           end
          else
           for k,v in next,h do
            found=v and (tonumber(v) or v.ligature)
            if found then
             pre_base_reordering_consonants[found]=true
             break
            end
           end
          end
          if found then
           break
          end
         end
        end
       end
      end
     end
    end
   end
   if two_defaults[script] then
    sharedfeatures["dv01"]=true 
    sharedfeatures["dv02"]=true 
    sharedfeatures["dv03"]=true 
    sharedfeatures["dv04"]=true 
   elseif one_defaults[script] then
    sharedfeatures["dv03"]=true 
    sharedfeatures["dv04"]=true 
   end
  end
 end
end
registerotffeature {
 name="devanagari",
 description="inject additional features",
 default=true,
 initializers={
  node=initializedevanagi,
 },
}
local function initializeconjuncts(tfmdata,value)
 if value then
  local resources=tfmdata.resources
  local devanagari=resources.devanagari
  if devanagari then
   local conjuncts="auto" 
   local movematra="auto" 
   if type(value)=="string" and value~="auto" then
    value=settings_to_hash(value)
    conjuncts=rawget(value,"conjuncts") or conjuncts
    movematra=rawget(value,"movematra") or movematra
   end
   if conjuncts=="auto" then
    conjuncts="mixed" 
   end
   if movematra=="auto" and
      script=="mlym" or
      script=="taml" then
    movematra="leftbeforebase"
   else
    movematra="default"
   end
   devanagari.conjuncts=conjuncts
   devanagari.movematra=movematra
   if trace_steps then
    report("conjuncts %a, movematra %a",conjuncts,movematra)
   end
  end
 end
end
registerotffeature {
 name="indic",
 description="control indic",
 default="auto",
 initializers={
  node=initializeconjuncts,
 },
}
local show_syntax_errors=false
local function inject_syntax_error(head,current,char)
 local signal=copy_node(current)
 copyinjection(signal,current)
 if pre_mark[char] then
  setchar(signal,dotted_circle)
 else
  setchar(current,dotted_circle)
 end
 return insertnodeafter(head,current,signal)
end
local function initialize_one(font,attr) 
 local tfmdata=fontdata[font]
 local datasets=otf.dataset(tfmdata,font,attr) 
 local devanagaridata=datasets.devanagari
 if not devanagaridata then
  devanagaridata={
   reph=false,
   vattu=false,
   blwfcache={},
   vatucache={},
   pstfcache={},
  }
  datasets.devanagari=devanagaridata
  local resources=tfmdata.resources
  local devanagari=resources.devanagari
  for s=1,#datasets do
   local dataset=datasets[s]
   if dataset and dataset[1] then 
    local kind=dataset[4]
    if kind=="rphf" then
     devanagaridata.reph=true
    elseif kind=="blwf" or kind=="vatu" then
     devanagaridata.vattu=true
     devanagaridata.blwfcache=devanagari.blwfcache
     devanagaridata.vatucache=devanagari.vatucache
     devanagaridata.pstfcache=devanagari.pstfcache
    end
   end
  end
 end
 return devanagaridata.reph,devanagaridata.vattu,devanagaridata.blwfcache,devanagaridata.vatucache,devanagaridata.pstfcache
end
local function contextchain(contexts,n)
 local char=getchar(n)
 if not contexts.n then
  return contexts[char]
 else
  for k=1,#contexts do
   local ck=contexts[k]
   local seq=ck[3]
   local f=ck[4]
   local l=ck[5]
   if (l-f)==1 and seq[f+1][char] then
    local ok=true
    local c=n
    for i=l+1,#seq do
     c=getnext(c)
     if not c or not seq[i][ischar(c)] then
      ok=false
      break
     end
    end
    if ok then
     c=getprev(n)
     for i=1,f-1 do
      c=getprev(c)
      if not c or not seq[f-i][ischar(c)] then
       ok=false
      end
     end
    end
    if ok then
     return true
    end
   end
  end
  return false
 end
end
local function order_matras(c)
 local cn=getnext(c)
 local char=getchar(cn)
 while dependent_vowel[char] do
  local next=getnext(cn)
  local cc=c
  local cchar=getchar(cc)
  while cc~=cn do
   if (above_mark[char] and (below_mark[cchar] or post_mark[cchar])) or (below_mark[char] and (post_mark[cchar])) then
    local prev,next=getboth(cn)
    if next then
     setprev(next,prev)
    end
    setnext(prev,next)
    setnext(getprev(cc),cn)
    setprev(cn,getprev(cc))
    setnext(cn,cc)
    setprev(cc,cn)
    break
   end
   cc=getnext(cc)
   cchar=getchar(cc)
  end
  cn=next
  char=getchar(cn)
 end
end
local swapped=table.swapped(states)
local function reorder_one(head,start,stop,font,attr,nbspaces)
 local reph,vattu,blwfcache,vatucache,pstfcache=initialize_one(font,attr)
 local current=start
 local n=getnext(start)
 local base=nil
 local firstcons=nil
 local lastcons=nil
 local basefound=false
 if reph and ra[getchar(start)] and halant[getchar(n)] then
  if n==stop then
   return head,stop,nbspaces
  end
  if getchar(getnext(n))==c_zwj then
   current=start
  else
   current=getnext(n)
   setstate(start,s_rphf)
  end
 end
 if getchar(current)==c_nbsp then
  if current==stop then
   stop=getprev(stop)
   head=remove_node(head,current)
   flushnode(current)
   if trace_steps then
    logprocess("reorder one, remove nbsp")
   end
   return head,stop,nbspaces
  else
   nbspaces=nbspaces+1
   base=current
   firstcons=current
   lastcons=current
   current=getnext(current)
   if current~=stop then
    local char=getchar(current)
    if nukta[char] then
     current=getnext(current)
     char=getchar(current)
    end
    if char==c_zwj and current~=stop then
     local next=getnext(current)
     if next~=stop and halant[getchar(next)] then
      current=next
      next=getnext(current)
      local tmp=next and getnext(next) or nil 
      local changestop=next==stop
      local tempcurrent=copy_node(next)
      copyinjection(tempcurrent,next)
      local nextcurrent=copy_node(current)
      copyinjection(nextcurrent,current) 
      setlink(tempcurrent,nextcurrent)
      setstate(tempcurrent,s_blwf)
      tempcurrent=processcharacters(tempcurrent,font)
      setstate(tempcurrent,unsetvalue)
      if getchar(next)==getchar(tempcurrent) then
       flushlist(tempcurrent)
       if show_syntax_errors then
        head,current=inject_syntax_error(head,current,char)
       end
      else
       setchar(current,getchar(tempcurrent)) 
       local freenode=getnext(current)
       setlink(current,tmp)
       flushnode(freenode)
       flushlist(tempcurrent)
       if changestop then
        stop=current
       end
      end
      if trace_steps then
       logprocess("reorder one, handle nbsp")
      end
     end
    end
   end
  end
 end
 while not basefound do
  local char=getchar(current)
  if consonant[char] then
   setstate(current,s_half)
   if not firstcons then
    firstcons=current
   end
   lastcons=current
   if not base then
    base=current
   elseif blwfcache[char] then
    setstate(current,s_blwf)
   elseif pstfcache[char] then
    setstate(current,s_pstf)
   else
    base=current
   end
  end
  basefound=current==stop
  current=getnext(current)
 end
 if base~=lastcons then
  local np=base
  local n=getnext(base)
  local ch=getchar(n)
  if nukta[ch] then
   np=n
   n=getnext(n)
   ch=getchar(n)
  end
  if halant[ch] then
   if lastcons~=stop then
    local ln=getnext(lastcons)
    if nukta[getchar(ln)] then
     lastcons=ln
    end
   end
   local nn=getnext(n)
   local ln=getnext(lastcons) 
   setlink(np,nn)
   setnext(lastcons,n)
   if ln then
    setprev(ln,n)
   end
   setnext(n,ln)
   setprev(n,lastcons)
   if lastcons==stop then
    stop=n
   end
   if trace_steps then
    logprocess("reorder one, handle halant")
   end
  end
 end
 n=getnext(start)
 if n~=stop and ra[getchar(start)] and halant[getchar(n)] and not zw_char[getchar(getnext(n))] then
  local matra=base
  if base~=stop then
   local next=getnext(base)
   if dependent_vowel[getchar(next)] then
    matra=next
   end
  end
  local sp=getprev(start)
  local nn=getnext(n)
  local mn=getnext(matra)
  setlink(sp,nn)
  setlink(matra,start)
  setlink(n,mn)
  if head==start then
   head=nn
  end
  start=nn
  if matra==stop then
   stop=n
  end
  if trace_steps then
   logprocess("reorder one, handle matra")
  end
 end
 local current=start
 while current~=stop do
  local next=getnext(current)
  if next~=stop and halant[getchar(next)] and getchar(getnext(next))==c_zwnj then
   setstate(current,unsetvalue)
  end
  current=next
 end
 if base~=stop and getstate(base) then 
  local next=getnext(base)
  if halant[getchar(next)] and not (next~=stop and getchar(getnext(next))==c_zwj) then
   setstate(base,unsetvalue)
  end
 end
 local current,allreordered,moved=start,false,{ [base]=true }
 local a,b,p,bn=base,base,base,getnext(base)
 if base~=stop and nukta[getchar(bn)] then
  a,b,p=bn,bn,bn
 end
 while not allreordered do
  local c=current
  local n=getnext(current)
  local l=nil 
  if c~=stop then
   local ch=getchar(n)
   if nukta[ch] then
    c=n
    n=getnext(n)
    ch=getchar(n)
   end
   if c~=stop then
    if halant[ch] then
     c=n
     n=getnext(n)
     ch=getchar(n)
    end
    local tpm=twopart_mark[ch]
    if tpm then
     while tpm do
      local extra=copy_node(n)
      copyinjection(extra,n)
      ch=tpm[1]
      setchar(n,ch)
      setchar(extra,tpm[2])
      head=insertnodeafter(head,current,extra)
      tpm=twopart_mark[ch]
     end
     if trace_steps then
      logprocess("reorder one, handle mark")
     end
    end
    while c~=stop and dependent_vowel[ch] do
     c=n
     n=getnext(n)
     ch=getchar(n)
    end
    if c~=stop then
     if vowel_modifier[ch] then
      c=n
      n=getnext(n)
      ch=getchar(n)
     end
     if c~=stop and stress_tone_mark[ch] then
      c=n
      n=getnext(n)
     end
    end
   end
  end
  local bp=getprev(firstcons)
  local cn=getnext(current)
  local last=getnext(c)
  local done=false
  while cn~=last do
   if pre_mark[getchar(cn)] then
    if devanagarihash[font].movematra=="leftbeforebase" then
     local prev,next=getboth(cn)
     setlink(prev,next)
     if cn==stop then
      stop=getprev(cn)
     end
     if base==start then
        if head==start then
         head=cn
        end
        start=cn
     end
     setlink(getprev(base),cn)
     setlink(cn,base)
     cn=next
    else
     if bp then
      setnext(bp,cn)
     end
     local prev,next=getboth(cn)
     if next then
      setprev(next,prev)
     end
     setnext(prev,next)
     if cn==stop then
      stop=prev
     end
     setprev(cn,bp)
     setlink(cn,firstcons)
     if firstcons==start then
      if head==start then
       head=cn
      end
      start=cn
     end
     cn=next
    end
    done=true
   elseif current~=base and dependent_vowel[getchar(cn)] then
    local prev,next=getboth(cn)
    if next then
     setprev(next,prev)
    end
    setnext(prev,next)
    if cn==stop then
     stop=prev
    end
    setlink(b,cn,getnext(b))
    order_matras(cn)
    cn=next
    done=true
   elseif current==base and dependent_vowel[getchar(cn)] then
    local cnn=getnext(cn)
    order_matras(cn)
    cn=cnn
    while cn~=last and dependent_vowel[getchar(cn)] do
     cn=getnext(cn)
    end
   else
    cn=getnext(cn)
   end
  end
  allreordered=c==stop
  current=getnext(c)
  if done and trace_steps then
   logprocess("reorder one, matra")
  end
 end
 if reph or vattu then
  local current=start
  local cns=nil
  local done=false
  while current~=stop do
   local c=current
   local n=getnext(current)
   if ra[getchar(current)] and halant[getchar(n)] then
    c=n
    n=getnext(n)
    local b,bn=base,base
    while bn~=stop  do
     local next=getnext(bn)
     if dependent_vowel[getchar(next)] then
      b=next
     end
     bn=next
    end
    if getstate(current,s_rphf) then
     if b~=current then
      if current==start then
       if head==start then
        head=n
       end
       start=n
      end
      if b==stop then
       stop=c
      end
      local prev=getprev(current)
      setlink(prev,n)
      local next=getnext(b)
      setlink(c,next)
      setlink(b,current)
      done=true
     end
    elseif cns and getnext(cns)~=current then
     local cp=getprev(current)
     local cnsn=getnext(cns)
     setlink(cp,n)
     setlink(cns,current) 
     setlink(c,cnsn)
     done=true
     if c==stop then
      stop=cp
      break
     end
     current=getprev(n)
    end
   else
    local char=getchar(current)
    if consonant[char] then
     cns=current
     local next=getnext(cns)
     if halant[getchar(next)] then
      cns=next
     end
     if not vatucache[char] then
      next=getnext(cns)
      while dependent_vowel[getchar(next)] do
       cns=next
       next=getnext(cns)
      end
     end
    elseif char==c_nbsp then
     nbspaces=nbspaces+1
     cns=current
     local next=getnext(cns)
     if halant[getchar(next)] then
      cns=next
     end
     if not vatucache[char] then
      next=getnext(cns)
      while dependent_vowel[getchar(next)] do
       cns=next
       next=getnext(cns)
      end
     end
    end
   end
   current=getnext(current)
  end
  if done and trace_steps then
   logprocess("reorder one, handle reph and vata") 
  end
 end
 if getchar(base)==c_nbsp then
  nbspaces=nbspaces-1
  if base==stop then
   stop=getprev(stop)
  end
  head=remove_node(head,base)
  flushnode(base)
 end
 return head,stop,nbspaces
end
function handlers.devanagari_reorder_matras(head,start) 
 local current=start 
 local startfont=getfont(start)
 local startattr=getprop(start,a_syllabe)
 while current do
  local char=ischar(current,startfont)
  local next=getnext(current)
  if char and getprop(current,a_syllabe)==startattr then
   if halant[char] then 
    if next then
     local char=ischar(next,startfont)
     if char and zw_char[char] and getprop(next,a_syllabe)==startattr then
      current=next
      next=getnext(current)
     end
    end
    local startnext=getnext(start)
    head=remove_node(head,start)
    setlink(start,next)
    setlink(current,start)
    start=startnext
    if trace_steps then
     logprocess("reorder matra")
    end
    break
   end
  else
   break
  end
  current=next
 end
 return head,start,true
end
local rephbase={}
function handlers.devanagari_reorder_reph(head,start)
 local current=getnext(start)
 local startnext=nil
 local startprev=nil
 local startfont=getfont(start)
 local startattr=getprop(start,a_syllabe)
 ::step_1::
 local char=ischar(start,startfont)
 local rephbase=rephbase[startfont][char]
 if char and after_subscript[rephbase] then
  goto step_5
 end
 ::step_2::
 if char and not after_postscript[rephbase] then
  while current do
   local char=ischar(current,startfont)
   if char and getprop(current,a_syllabe)==startattr then
    if halant[char] then
     if trace_steps then
      logprocess("reorder reph, handling halant")
     end
     local next=getnext(current)
     if next then
      local nextchar=ischar(next,startfont)
      if nextchar and zw_char[nextchar] and getprop(next,a_syllabe)==startattr then
       current=next
       next=getnext(current)
      end
     end
     startnext=getnext(start)
     head=remove_node(head,start)
     setlink(start,next)
     setlink(current,start)
     start=startnext
     startattr=getprop(start,a_syllabe)
     break
    end
    current=getnext(current)
   else
    break
   end
  end
 end
 ::step_3::
 if not startnext then
  if char and after_main[rephbase] then
   current=getnext(start)
   while current do
    local char=ischar(current,startfont)
    if char and getprop(current,a_syllabe)==startattr then
     if consonant[char] and not getstate(current,s_pref) then
      if trace_steps then
       logprocess("reorder reph, handling consonant")
      end
      startnext=getnext(start)
      head=remove_node(head,start)
      setlink(current,start)
      setlink(start,getnext(current))
      start=startnext
      startattr=getprop(start,a_syllabe)
      break
     end
     current=getnext(current)
    else
     break
    end
   end
  end
 end
 ::step_4::
 if not startnext then
  if char and before_postscript[rephbase] then
   current=getnext(start)
   local c=nil
   while current do
    local char=ischar(current,startfont)
    if char and getprop(current,a_syllabe)==startattr then
     if getstate(current,s_pstf) then 
      if trace_steps then
       logprocess("reorder reph, before postscript, post base")
      end
      startnext=getnext(start)
      head=remove_node(head,start)
      setlink(getprev(current),start)
      setlink(start,current)
      start=startnext
      startattr=getprop(start,a_syllabe)
      break
     elseif not c and (vowel_modifier[char] or stress_tone_mark[char]) then
      c=current
     end
     current=getnext(current)
    else
     if c then
      if trace_steps then
       logprocess("reorder reph, before postscript")
      end
      startnext=getnext(start)
      head=remove_node(head,start)
      setlink(getprev(c),start)
      setlink(start,c)
      start=startnext
      startattr=getprop(start,a_syllabe)
     end
     break
    end
   end
  end
 end
 ::step_5::
 if not startnext then
  current=getnext(start)
  local c=nil
  while current do
   local char=ischar(current,startfont)
   if char and getprop(current,a_syllabe)==startattr then
    local state=getstate(current)
    if before_subscript[rephbase] and (state==s_blwf or state==s_pstf) then
     c=current
     if trace_steps then
      logprocess("reorder reph, before subscript")
     end
    elseif after_subscript[rephbase] and (state==s_pstf) then
     if trace_steps then
      logprocess("reorder reph, after subscript")
     end
     c=current
    end
    current=getnext(current)
   else
    break
   end
  end
  if c then
   startnext=getnext(start)
   head=remove_node(head,start)
   setlink(getprev(c),start)
   setlink(start,c)
   start=startnext
   startattr=getprop(start,a_syllabe)
  end
 end
 ::step_6::
 if not startnext then
  current=start
  local next=getnext(current)
  while next do
   local nextchar=ischar(next,startfont)
   if nextchar and getprop(next,a_syllabe)==startattr then
    current=next
    next=getnext(current)
   else
    break
   end
  end
  if start~=current then
   if trace_steps then
    logprocess("reorder reph, to end")
   end
   startnext=getnext(start)
   head=remove_node(head,start)
   setlink(start,getnext(current))
   setlink(current,start)
   start=startnext
  end
 end
 return head,start,true
end
function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
 if getprop(start,a_reordered) then
  return head,start,true
 end
 local current=start 
 local startfont=getfont(start)
 local startattr=getprop(start,a_syllabe)
 while current do
  local char=ischar(current,startfont)
  local next=getnext(current)
  if char and getprop(current,a_syllabe)==startattr then
   if halant[char] then 
    if trace_steps then
     logprocess("reorder pre base consonants, handle halant")
    end
    if next then
     local char=ischar(next,startfont)
     if char and zw_char[char] and getprop(next,a_syllabe)==startattr then
      current=next
      next=getnext(current)
     end
    end
    local startnext=getnext(start)
    head=remove_node(head,start)
    setlink(start,next)
    setlink(current,start)
    setprop(start,"reordered",true)
    start=startnext
    return head,start,true
   end
  else
   break
  end
  current=next
 end
 local startattr=getprop(start,a_syllabe)
 local current=getprev(start)
 while current and getprop(current,a_syllabe)==startattr do
  local char=ischar(current)
  if (not dependent_vowel[char] and (not getstate(current) or getstate(current,s_init))) then
   if trace_steps then
    logprocess("reorder pre base consonants, handle vowel or initial")
   end
   startnext=getnext(start)
   head=remove_node(head,start)
   if current==head then
    setlink(start,current)
    head=start
   else
    setlink(getprev(current),start)
    setlink(start,current)
   end
   setprop(start,"reordered",true)
   start=startnext
   break
  end
  current=getprev(current)
 end
 return head,start,true
end
function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replacement)
 local stop=getnext(start)
 local font=getfont(start)
 local last=start
 while stop do
  local char=ischar(stop,font)
  if char and (char==c_zwnj or char==c_zwj) then
   last=stop
   stop=getnext(stop)
  else
   break
  end
 end
 local prev=getprev(start)
 if stop then
  setnext(last)
  setlink(prev,stop)
 elseif prev then
  setnext(prev)
 end
 if head==start then
  head=stop
 end
 flushlist(start)
 if trace_steps then
  logprocess("remove joiners")
 end
 return head,stop,true
end
local function initialize_two(font,attr)
 local devanagari=fontdata[font].resources.devanagari
 if devanagari then
  return devanagari.seqsubset or {},devanagari.reorderreph or {}
 else
  return {},{}
 end
end
local function reorder_two(head,start,stop,font,attr,nbspaces) 
 local seqsubset,reorderreph=initialize_two(font,attr)
 local halfpos=nil
 local basepos=nil
 local subpos=nil
 local postpos=nil
 reorderreph.coverage={} 
 rephbase[font]={} 
 for i=1,#seqsubset do
  local subset=seqsubset[i]
  local kind=subset[1]
  local lookupcache=subset[2]
  if kind=="rphf" then
   local reph=subset[3]
   local base=subset[4]
   reorderreph.coverage[reph]=true 
   rephbase[font][reph]=base
   local current=start
   local last=getnext(stop)
   while current~=last do
    if current~=stop then
     local c=getchar(current)
     local found=lookupcache[c]
     if found then
      local next=getnext(current)
      if contextchain(found,next) then 
       local afternext=next~=stop and getnext(next)
       if afternext and zw_char[getchar(afternext)] then 
        current=afternext 
       elseif current==start then
        setstate(current,s_rphf)
        current=next 
       else
        current=next 
       end
      end
     end
    end
    current=getnext(current)
   end
  elseif kind=="pref" then
   local current=start
   local last=getnext(stop)
   while current~=last do
    if current~=stop then
     local c=getchar(current)
     local found=lookupcache[c]
     if found then 
      local next=getnext(current)
      if contextchain(found,next) then
       if not getstate(current) and not getstate(next) then 
        setstate(current,s_pref)
        setstate(next,s_pref)
        current=next
       end
      end
     end
    end
    current=getnext(current)
   end
  elseif kind=="half" then 
   local current=start
   local last=getnext(stop)
   while current~=last do
    if current~=stop then
     local c=getchar(current)
     local found=lookupcache[c]
     if found then
      local next=getnext(current)
      if contextchain(found,next) then
       if next~=stop and getchar(getnext(next))==c_zwnj then 
        current=next
       elseif not getstate(current) then 
        setstate(current,s_half)
        if not halfpos then
         halfpos=current
        end
       end
       current=getnext(current)
      end
     end
    end
    current=getnext(current)
   end
  elseif kind=="blwf" or kind=="vatu" then 
   local current=start
   local last=getnext(stop)
   while current~=last do
    if current~=stop then
     local c=getchar(current)
     local found=lookupcache[c]
     if found then
      local next=getnext(current)
      if contextchain(found,next) then
       if not getstate(current) and not getstate(next) then 
        setstate(current,s_blwf)
        setstate(next,s_blwf)
        current=next
        subpos=current
       end
      end
     end
    end
    current=getnext(current)
   end
  elseif kind=="pstf" then 
   local current=start
   local last=getnext(stop)
   while current~=last do
    if current~=stop then
     local c=getchar(current)
     local found=lookupcache[c]
     if found then
      local next=getnext(current)
      if contextchain(found,next) then
       if not getstate(current) and not getstate(next) then 
        setstate(current,s_pstf)
        setstate(next,s_pstf)
        current=next
        postpos=current
       end
      end
     end
    end
    current=getnext(current)
   end
  end
 end
 local current,base,firstcons=start,nil,nil
 if getstate(start,s_rphf) then
  current=getnext(getnext(start))
 end
 if current~=getnext(stop) and getchar(current)==c_nbsp then
  if current==stop then
   stop=getprev(stop)
   head=remove_node(head,current)
   flushnode(current)
   if trace_steps then
    logprocess("reorder two, remove nbsp")
   end
   return head,stop,nbspaces
  else
   nbspaces=nbspaces+1
   base=current
   current=getnext(current)
   if current~=stop then
    local char=getchar(current)
    if nukta[char] then
     current=getnext(current)
     char=getchar(current)
    end
    if char==c_zwj then
     local next=getnext(current)
     if current~=stop and next~=stop and halant[getchar(next)] then
      current=next
      next=getnext(current)
      local tmp=getnext(next)
      local changestop=next==stop
      setnext(next)
      setstate(current,s_pref)
      current=processcharacters(current,font)
      setstate(current,s_blwf)
      current=processcharacters(current,font)
      setstate(current,s_pstf)
      current=processcharacters(current,font)
      setstate(current,unsetvalue)
      if halant[getchar(current)] then
       setnext(getnext(current),tmp)
       if show_syntax_errors then
        head,current=inject_syntax_error(head,current,char)
       end
      else
       setnext(current,tmp) 
       if changestop then
        stop=current
       end
      end
     end
    end
   end
   if trace_steps then
    logprocess("reorder two, handle nbsp")
   end
  end
 else 
  local last=getnext(stop)
  while current~=last do 
   local next=getnext(current)
   if consonant[getchar(current)] then
    if not (current~=stop and next~=stop and halant[getchar(next)] and getchar(getnext(next))==c_zwj) then
     if not firstcons then
      firstcons=current
     end
     local a=getstate(current)
     if not (a==s_blwf or a==s_pstf or (a~=s_rphf and a~=s_blwf and ra[getchar(current)])) then
      base=current
     end
    end
   end
   current=next
  end
  if not base then
   base=firstcons
  end
 end
 if not base then
  if getstate(start,s_rphf) then
   setstate(start,unsetvalue)
  end
  return head,stop,nbspaces
 else
  if getstate(base) then 
   setstate(base,unsetvalue)  
  end
  basepos=base
 end
 if not halfpos then
  halfpos=base
 end
 if not subpos then
  subpos=base
 end
 if not postpos then
  postpos=subpos or base
 end
 local moved={}
 local current=start
 local last=getnext(stop)
 while current~=last do
  local char=getchar(current)
  local target=nil
  local cn=getnext(current)
  local tpm=twopart_mark[char]
  if tpm then
   while tpm do
    local extra=copy_node(current)
    copyinjection(extra,current)
    char=tpm[1]
    setchar(current,char)
    setchar(extra,tpm[2])
    head=insertnodeafter(head,current,extra)
    tpm=twopart_mark[char]
   end
   if tpm and trace_steps then
    logprocess("reorder two, handle matra")
   end
  end
  if not moved[current] and dependent_vowel[char] then
   if pre_mark[char] then 
    moved[current]=true
    local prev,next=getboth(current)
    setlink(prev,next)
    if current==stop then
     stop=getprev(current)
    end
    local pos
    if before_main[char] then
     pos=basepos
    else
     pos=halfpos
    end
    local ppos=getprev(pos) 
    while ppos and getprop(ppos,a_syllabe)==getprop(pos,a_syllabe) do
     if getstate(ppos,s_pref) then
      pos=ppos
     end
     ppos=getprev(ppos)
    end
    local ppos=getprev(pos) 
    while ppos and getprop(ppos,a_syllabe)==getprop(pos,a_syllabe) and halant[ischar(ppos)] do
     ppos=getprev(ppos)
     if ppos and getprop(ppos,a_syllabe)==getprop(pos,a_syllabe) and consonant[ischar(ppos)] then
      pos=ppos
      ppos=getprev(ppos)
     else
      break
     end
    end
    if pos==start then
     if head==start then
      head=current
     end
     start=current
    end
    setlink(getprev(pos),current)
    setlink(current,pos)
    if trace_steps then
     logprocess("reorder two, handle pre mark")
    end
   elseif above_mark[char] then
    target=basepos
    if subpos==basepos then
     subpos=current
    end
    if postpos==basepos then
     postpos=current
    end
    basepos=current
   elseif below_mark[char] then
    target=subpos
    if postpos==subpos then
     postpos=current
    end
    subpos=current
   elseif post_mark[char] then
    local n=getnext(postpos) 
    while n do
     local v=ischar(n,font)
     if nukta[v] or stress_tone_mark[v] or vowel_modifier[v] then
      postpos=n
     else
      break
     end
     n=getnext(n)
    end
    target=postpos
    postpos=current
   end
   if mark_above_below_post[char] then
    local prev=getprev(current)
    if prev~=target then
     local next=getnext(current)
     setlink(prev,next)
     if current==stop then
      stop=prev
     end
     setlink(current,getnext(target))
     setlink(target,current)
     if trace_steps then
      logprocess("reorder two, handle mark")
     end
    end
   end
  end
  current=cn
 end
 local current=getnext(start)
 local last=getnext(stop)
 while current~=last do
  local char=getchar(current)
  local cn=getnext(current)
  if halant[char] and ra[ischar(cn)] and (not getstate(cn,s_rphf)) and (not getstate(cn,s_blwf)) then
   if after_main[ischar(cn)] then
    local prev=getprev(current)
    local next=getnext(cn)
    local bpn=getnext(basepos)
    while bpn and dependent_vowel[ischar(bpn)] do
     basepos=bpn
     bpn=getnext(bpn)
    end
    if basepos~=prev then
     setlink(prev,next)
     setlink(cn,getnext(basepos))
     setlink(basepos,current)
     if cn==stop then
      stop=prev
     end
     cn=next
     if trace_steps then
      logprocess("reorder two, handle halant and ra")
     end
    end
   end
  end
  current=cn
 end
 local current=start
 local c=nil
 while current~=stop do
  local char=getchar(current)
  if halant[char] or stress_tone_mark[char] then
   if not c then
    c=current
   end
  else
   c=nil
  end
  local next=getnext(current)
  if c and nukta[getchar(next)] then
   if head==c then
    head=next
   end
   if stop==next then
    stop=current
   end
   setlink(getprev(c),next)
   local nextnext=getnext(next)
   setnext(current,nextnext)
   local nextnextnext=getnext(nextnext)
   if nextnextnext then
    setprev(nextnextnext,current)
   end
   setlink(nextnext,c)
   if trace_steps then
    logprocess("reorder two, handle nukta")
   end
  end
  if stop==current then break end
  current=getnext(current)
 end
 if getchar(base)==c_nbsp then
  if base==stop then
   stop=getprev(stop)
  end
  nbspaces=nbspaces-1
  head=remove_node(head,base)
  flushnode(base)
  if trace_steps then
   logprocess("reorder two, handle nbsp")
  end
 end
 return head,stop,nbspaces
end
local separator={}
imerge(separator,consonant)
imerge(separator,independent_vowel)
imerge(separator,dependent_vowel)
imerge(separator,vowel_modifier)
imerge(separator,stress_tone_mark)
for k,v in next,nukta  do separator[k]=true end
for k,v in next,halant do separator[k]=true end
local function analyze_next_chars_one(c,font,variant)
 local n=getnext(c)
 if not n then
  return c
 end
 if variant==1 then
  local v=ischar(n,font)
  if v and nukta[v] then
   n=getnext(n)
   if n then
    v=ischar(n,font)
   end
  end
  if n and v then
   local nn=getnext(n)
   if nn then
    local vv=ischar(nn,font)
    if vv then
     local nnn=getnext(nn)
     if nnn then
      local vvv=ischar(nnn,font)
      if vvv then
       if vv==c_zwj and consonant[vvv] then
        c=nnn
       elseif (vv==c_zwnj or vv==c_zwj) and halant[vvv] then
        local nnnn=getnext(nnn)
        if nnnn then
         local vvvv=ischar(nnnn,font)
         if vvvv and consonant[vvvv] then
          c=nnnn
         end
        end
       end
      end
     end
    end
   end
  end
 elseif variant==2 then
  local v=ischar(n,font)
  if v and nukta[v] then
   c=n
  end
  n=getnext(c)
  if n then
   v=ischar(n,font)
   if v then
    local nn=getnext(n)
    if nn then
     local vv=ischar(nn,font)
     if vv and zw_char[v] then
      n=nn
      v=vv
      nn=getnext(nn)
      vv=nn and ischar(nn,font)
     end
     if vv and halant[v] and consonant[vv] then
      c=nn
     end
    end
   end
  end
 end
 local n=getnext(c)
 if not n then
  return c
 end
 local v=ischar(n,font)
 if not v then
  return c
 end
 local already_pre_mark   
 local already_above_mark 
 local already_below_mark 
 local already_post_mark  
 while dependent_vowel[v] do
  local vowels=twopart_mark[v]
  if vowels then
   for k=1,#vowels do
    local v=vowels[k]
    if pre_mark[v] and not already_pre_mark then
     already_pre_mark=true
    elseif above_mark[v] and not already_above_mark then
     already_above_mark=true
    elseif below_mark[v] and not already_below_mark then
     already_below_mark=true
    elseif post_mark[v] and not already_post_mark then
     already_post_mark=true
    elseif devanagarihash[font].conjuncts=="continue" then
    else
     return c
    end
   end
  else
   if pre_mark[v] and not already_pre_mark then
    already_pre_mark=true
   elseif post_mark[v] and not already_post_mark then
    if devanagarihash[font].conjuncts=="mixed" then
     return c
    else
     already_post_mark=true
    end
   elseif below_mark[v] and not already_below_mark then
    already_below_mark=true
   elseif above_mark[v] and not already_above_mark then
    already_above_mark=true
   elseif devanagarihash[font].conjuncts=="continue" then
   else
    return c
   end
  end
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if nukta[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if halant[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if vowel_modifier[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if stress_tone_mark[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if stress_tone_mark[v] then
  return n
 else
  return c
 end
end
local function analyze_next_chars_two(c,font)
 local n,v
 n=getnext(c)
 if not n then
  return c
 end
 v=ischar(n,font)
 if v and nukta[v] then
  c=n
 end
 n=c
 while true do
  local nn=getnext(n)
  if nn then
   local vv=ischar(nn,font)
   if vv then
    if halant[vv] then
     n=nn
     local nnn=getnext(nn)
     if nnn then
      local vvv=ischar(nnn,font)
      if vvv and zw_char[vvv] then
       n=nnn
      end
     end
    elseif vv==c_zwnj or vv==c_zwj then
     local nnn=getnext(nn)
     if nnn then
      local vvv=ischar(nnn,font)
      if vvv and halant[vvv] then
       n=nnn
      end
     end
    else
     break
    end
    local nn=getnext(n)
    if nn then
     local vv=ischar(nn,font)
     if vv and consonant[vv] then
      n=nn
      local nnn=getnext(nn)
      if nnn then
       local vvv=ischar(nnn,font)
       if vvv and nukta[vvv] then
        n=nnn
       end
      end
      c=n
     else
      break
     end
    else
     break
    end
   else
    break
   end
  else
   break
  end
 end
 if not c then
  return
 end
 n=getnext(c)
 if not n then
  return c
 end
 v=ischar(n,font)
 if not v then
  return c
 end
 if anudatta[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if halant[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
  if v==c_zwnj or v==c_zwj then
   c=n
   n=getnext(c)
   if not n then
    return c
   end
   v=ischar(n,font)
   if not v then
    return c
   end
  end
 else
  local already_pre_mark   
  local already_above_mark 
  local already_below_mark 
  local already_post_mark
  while dependent_vowel[v] do
   local vowels=twopart_mark[v]
   if vowels then
    for k=1,#vowels do
     local v=vowels[k]
     if pre_mark[v] and not already_pre_mark then
      already_pre_mark=true
     elseif above_mark[v] and not already_above_mark then
      already_above_mark=true
     elseif below_mark[v] and not already_below_mark then
      already_below_mark=true
     elseif post_mark[v] and not already_post_mark then
      already_post_mark=true
     elseif devanagarihash[font].conjuncts=="continue" then
     else
      return c
     end
    end
   else
    if pre_mark[v] and not already_pre_mark then
     already_pre_mark=true
    elseif post_mark[v] and not already_post_mark then
     if devanagarihash[font].conjuncts=="mixed" then
      return c
     else
      already_post_mark=true
     end
    elseif below_mark[v] and not already_below_mark then
     already_below_mark=true
    elseif above_mark[v] and not already_above_mark then
     already_above_mark=true
    elseif devanagarihash[font].conjuncts=="continue" then
    else
     return c
    end
   end
   c=n
   n=getnext(c)
   if not n then
    return c
   end
   v=ischar(n,font)
   if not v then
    return c
   end
  end
  if nukta[v] then
   c=n
   n=getnext(c)
   if not n then
    return c
   end
   v=ischar(n,font)
   if not v then
    return c
   end
  end
  if halant[v] then
   c=n
   n=getnext(c)
   if not n then
    return c
   end
   v=ischar(n,font)
   if not v then
    return c
   end
  end
 end
 if vowel_modifier[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if stress_tone_mark[v] then
  c=n
  n=getnext(c)
  if not n then
   return c
  end
  v=ischar(n,font)
  if not v then
   return c
  end
 end
 if stress_tone_mark[v] then
  return n
 else
  return c
 end
end
local function method_one(head,font,attr)
 local current=head
 local start=true
 local done=false
 local nbspaces=0
 local syllabe=0
 while current do
  local char=ischar(current,font)
  if char then
   done=true
   local syllablestart=current
   local syllableend=nil
   local c=current
   local n=getnext(c)
   local first=char
   if n and ra[first] then
    local second=ischar(n,font)
    if second and halant[second] then
     local n=getnext(n)
     if n then
      local third=ischar(n,font)
      if third then
       c=n
       first=third
      end
     end
    end
   end
   local standalone=first==c_nbsp
   if standalone then
    local prev=getprev(current)
    if prev then
     local prevchar=ischar(prev,font)
     if not prevchar then
     elseif not separator[prevchar] then
     else
      standalone=false
     end
    else
    end
   end
   if standalone then
    local syllableend=analyze_next_chars_one(c,font,2)
    current=getnext(syllableend)
    if syllablestart~=syllableend then
     head,current,nbspaces=reorder_one(head,syllablestart,syllableend,font,attr,nbspaces)
     current=getnext(current)
    end
   else
    if consonant[char] then
     local prevc=true
     while prevc do
      prevc=false
      local n=getnext(current)
      if not n then
       break
      end
      local v=ischar(n,font)
      if not v then
       break
      end
      if nukta[v] then
       n=getnext(n)
       if not n then
        break
       end
       v=ischar(n,font)
       if not v then
        break
       end
      end
      if halant[v] then
       n=getnext(n)
       if not n then
        break
       end
       v=ischar(n,font)
       if not v then
        break
       end
       if v==c_zwnj or v==c_zwj then
        n=getnext(n)
        if not n then
         break
        end
        v=ischar(n,font)
        if not v then
         break
        end
       end
       if consonant[v] then
        prevc=true
        current=n
       end
      end
     end
     local n=getnext(current)
     if n then
      local v=ischar(n,font)
      if v and nukta[v] then
       current=n
       n=getnext(current)
      end
     end
     syllableend=current
     current=n
     if current then
      local v=ischar(current,font)
      if not v then
      elseif halant[v] then
       local n=getnext(current)
       if n then
        local v=ischar(n,font)
        if v and zw_char[v] then
         syllableend=n
         current=getnext(n)
        else
         syllableend=current
         current=n
        end
       else
        syllableend=current
        current=n
       end
      else
       if dependent_vowel[v] then
        syllableend=current
        current=getnext(current)
        v=ischar(current,font)
       end
       if v and vowel_modifier[v] then
        syllableend=current
        current=getnext(current)
        v=ischar(current,font)
       end
       if v and stress_tone_mark[v] then
        syllableend=current
        current=getnext(current)
       end
      end
     end
     if syllablestart~=syllableend then
      if syllableend then
       syllabe=syllabe+1
       local c=syllablestart
       local n=getnext(syllableend)
       while c~=n do
        setprop(c,a_syllabe,syllabe)
        c=getnext(c)
       end
      end
      head,current,nbspaces=reorder_one(head,syllablestart,syllableend,font,attr,nbspaces)
      current=getnext(current)
     end
    elseif independent_vowel[char] then
     syllableend=current
     current=getnext(current)
     if current then
      local v=ischar(current,font)
      if v then
       if vowel_modifier[v] then
        syllableend=current
        current=getnext(current)
        v=ischar(current,font)
       end
       if v and stress_tone_mark[v] then
        syllableend=current
        current=getnext(current)
       end
      end
     end
    else
     if show_syntax_errors then
      local mark=mark_pre_above_below_post[char]
      if mark then
       head,current=inject_syntax_error(head,current,char)
      end
     end
     current=getnext(current)
    end
   end
  else
   current=getnext(current)
  end
  start=false
 end
 if nbspaces>0 then
  head=replace_all_nbsp(head)
 end
 current=head
 local n=0
 while current do
  local char=ischar(current,font)
  if char then
   if n==0 and not getstate(current) then
    setstate(current,s_init)
   end
   n=n+1
  else
   n=0
  end
  current=getnext(current)
 end
 return head,done
end
local function method_two(head,font,attr)
 local current=head
 local start=true
 local done=false
 local syllabe=0
 local nbspaces=0
 while current do
  local syllablestart=nil
  local syllableend=nil
  local char=ischar(current,font)
  if char then
   done=true
   syllablestart=current
   local c=current
   local n=getnext(current)
   if n and ra[char] then
    local nextchar=ischar(n,font)
    if nextchar and halant[nextchar] then
     local n=getnext(n)
     if n then
      local nextnextchar=ischar(n,font)
      if nextnextchar then
       c=n
       char=nextnextchar
      end
     end
    end
   end
   if independent_vowel[char] then
    current=analyze_next_chars_one(c,font,1)
    syllableend=current
   else
    local standalone=char==c_nbsp
    if standalone then
     nbspaces=nbspaces+1
     local p=getprev(current)
     if not p then
     elseif ischar(p,font) then
     elseif not separator[getchar(p)] then
     else
      standalone=false
     end
    end
    if standalone then
     current=analyze_next_chars_one(c,font,2)
     syllableend=current
    elseif consonant[getchar(current)] then
     current=analyze_next_chars_two(current,font) 
     syllableend=current
    end
   end
  end
  if syllableend then
   syllabe=syllabe+1
   local c=syllablestart
   local n=getnext(syllableend)
   while c~=n do
    setprop(c,a_syllabe,syllabe)
    c=getnext(c)
   end
  end
  if syllableend and syllablestart~=syllableend then
   head,current,nbspaces=reorder_two(head,syllablestart,syllableend,font,attr,nbspaces)
  end
  if not syllableend and show_syntax_errors then
   local char=ischar(current,font)
   if char and not getstate(current) then 
    local mark=mark_pre_above_below_post[char]
    if mark then
     head,current=inject_syntax_error(head,current,char)
    end
   end
  end
  start=false
  current=getnext(current)
 end
 if nbspaces>0 then
  head=replace_all_nbsp(head)
 end
 current=head
 local n=0
 while current do
  local char=ischar(current,font)
  if char then
   if n==0 and not getstate(current) then 
    setstate(current,s_init)
   end
   n=n+1
  else
   n=0
  end
  current=getnext(current)
 end
 return head,done
end
for i=1,nofscripts do
 methods[scripts_one[i]]=method_one
 methods[scripts_two[i]]=method_two
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-osd”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ocl” 2a377351ae23c339764ec8ce2e8e9164] ---

if not modules then modules={} end modules ['font-ocl']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local tostring,tonumber,next=tostring,tonumber,next
local round,max=math.round,math.round
local gsub,find=string.gsub,string.find
local sortedkeys,sortedhash,concat=table.sortedkeys,table.sortedhash,table.concat
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local tounicode=fonts.mappings.tounicode
local helpers=fonts.helpers
local charcommand=helpers.commands.char
local rightcommand=helpers.commands.right
local leftcommand=helpers.commands.left
local downcommand=helpers.commands.down
local otf=fonts.handlers.otf
local otfregister=otf.features.register
local f_color=formatters["%.3f %.3f %.3f rg"]
local f_gray=formatters["%.3f g"]
if context then
 local startactualtext=nil
 local stopactualtext=nil
 function otf.getactualtext(s)
  if not startactualtext then
   startactualtext=backends.codeinjections.startunicodetoactualtextdirect
   stopactualtext=backends.codeinjections.stopunicodetoactualtextdirect
  end
  return startactualtext(s),stopactualtext()
 end
else
 local tounicode=fonts.mappings.tounicode16
 function otf.getactualtext(s)
  return
   "/Span << /ActualText <feff"..s.."> >> BDC",
   "EMC"
 end
end
local sharedpalettes={}
local hash=setmetatableindex(function(t,k)
 local v={ "pdf","direct",k }
 t[k]=v
 return v
end)
if context then
 local colors=attributes.list[attributes.private('color')] or {}
 local transparencies=attributes.list[attributes.private('transparency')] or {}
 function otf.registerpalette(name,values)
  sharedpalettes[name]=values
  local color=lpdf.color
  local transparency=lpdf.transparency
  local register=colors.register
  for i=1,#values do
   local v=values[i]
   if v=="textcolor" then
    values[i]=false
   else
    local c=nil
    local t=nil
    if type(v)=="table" then
     c=register(name,"rgb",
      max(round((v.r or 0)*255),255)/255,
      max(round((v.g or 0)*255),255)/255,
      max(round((v.b or 0)*255),255)/255
     )
    else
     c=colors[v]
     t=transparencies[v]
    end
    if c and t then
     values[i]=hash[color(1,c).." "..transparency(t)]
    elseif c then
     values[i]=hash[color(1,c)]
    elseif t then
     values[i]=hash[color(1,t)]
    end
   end
  end
 end
else 
 function otf.registerpalette(name,values)
  sharedpalettes[name]=values
  for i=1,#values do
   local v=values[i]
   if v then
    values[i]=hash[f_color(
     max(round((v.r or 0)*255),255)/255,
     max(round((v.g or 0)*255),255)/255,
     max(round((v.b or 0)*255),255)/255
    )]
   end
  end
 end
end
local function convert(t,k)
 local v={}
 for i=1,#k do
  local p=k[i]
  local r,g,b=p[1],p[2],p[3]
  if r==g and g==b then
   v[i]=hash[f_gray(r/255)]
  else
   v[i]=hash[f_color(r/255,g/255,b/255)]
  end
 end
 t[k]=v
 return v
end
local mode={ "pdf","mode","font" }
local push={ "pdf","page","q" }
local pop={ "pdf","page","Q" }
local function initializeoverlay(tfmdata,kind,value)
 if value then
  local resources=tfmdata.resources
  local palettes=resources.colorpalettes
  if palettes then
   local converted=resources.converted
   if not converted then
    converted=setmetatableindex(convert)
    resources.converted=converted
   end
   local colorvalues=sharedpalettes[value]
   local default=false 
   if colorvalues then
    default=colorvalues[#colorvalues]
   else
    colorvalues=converted[palettes[tonumber(value) or 1] or palettes[1]] or {}
   end
   local classes=#colorvalues
   if classes==0 then
    return
   end
   local characters=tfmdata.characters
   local descriptions=tfmdata.descriptions
   local properties=tfmdata.properties
   properties.virtualized=true
   tfmdata.fonts={
    { id=0 }
   }
   local getactualtext=otf.getactualtext
   local b,e=getactualtext(tounicode(0xFFFD))
   local actualb={ "pdf","page",b } 
   local actuale={ "pdf","page",e }
   for unicode,character in next,characters do
    local description=descriptions[unicode]
    if description then
     local colorlist=description.colors
     if colorlist then
      local u=description.unicode or characters[unicode].unicode
      local w=character.width or 0
      local s=#colorlist
      local goback=w~=0 and leftcommand[w] or nil 
      local t={
       mode,
       not u and actualb or { "pdf","page",(getactualtext(tounicode(u))) },
       push,
      }
      local n=3
      local l=nil
      for i=1,s do
       local entry=colorlist[i]
       local v=colorvalues[entry.class] or default
       if v and l~=v then
        n=n+1 t[n]=v
        l=v
       end
       n=n+1 t[n]=charcommand[entry.slot]
       if s>1 and i<s and goback then
        n=n+1 t[n]=goback
       end
      end
      n=n+1 t[n]=pop
      n=n+1 t[n]=actuale
      character.commands=t
     end
    end
   end
   return true
  end
 end
end
otfregister {
 name="colr",
 description="color glyphs",
 manipulators={
  base=initializeoverlay,
  node=initializeoverlay,
 }
}
do
 local nofstreams=0
 local f_name=formatters[ [[pdf-glyph-%05i]] ]
 local f_used=context and formatters[ [[original:///%s]] ] or formatters[ [[%s]] ]
 local hashed={}
 local cache={}
 local openpdf=pdfe.new
 function otf.storepdfdata(pdf)
  local done=hashed[pdf]
  if not done then
   nofstreams=nofstreams+1
   local f=f_name(nofstreams)
   local n=openpdf(pdf,#pdf,f)
   done=f_used(n)
   hashed[pdf]=done
  end
  return done
 end
end
local function pdftovirtual(tfmdata,pdfshapes,kind) 
 if not tfmdata or not pdfshapes or not kind then
  return
 end
 local characters=tfmdata.characters
 local properties=tfmdata.properties
 local parameters=tfmdata.parameters
 local hfactor=parameters.hfactor
 properties.virtualized=true
 tfmdata.fonts={
  { id=0 } 
 }
 local getactualtext=otf.getactualtext
 local storepdfdata=otf.storepdfdata
 local b,e=getactualtext(tounicode(0xFFFD))
 local actualb={ "pdf","page",b } 
 local actuale={ "pdf","page",e }
 local vfimage=lpdf and lpdf.vfimage or function(wd,ht,dp,data,name)
  local name=storepdfdata(data)
  return { "image",{ filename=name,width=wd,height=ht,depth=dp } }
 end
 for unicode,character in sortedhash(characters) do  
  local index=character.index
  if index then
   local pdf=pdfshapes[index]
   local typ=type(pdf)
   local data=nil
   local dx=nil
   local dy=nil
   local scale=1
   if typ=="table" then
    data=pdf.data
    dx=pdf.x or pdf.dx or 0
    dy=pdf.y or pdf.dy or 0
    scale=pdf.scale or 1
   elseif typ=="string" then
    data=pdf
    dx=0
    dy=0
   elseif typ=="number" then
    data=pdf
    dx=0
    dy=0
   end
   if data then
    local bt=unicode and getactualtext(unicode)
    local wd=character.width  or 0
    local ht=character.height or 0
    local dp=character.depth  or 0
    character.commands={
     not unicode and actualb or { "pdf","page",(getactualtext(unicode)) },
     downcommand [dp+dy*hfactor],
     rightcommand[  dx*hfactor],
     vfimage(scale*wd,ht,dp,data,pdfshapes.filename or ""),
     actuale,
    }
    character[kind]=true
   end
  end
 end
end
local otfsvg=otf.svg or {}
otf.svg=otfsvg
otf.svgenabled=true
do
 local report_svg=logs.reporter("fonts","svg conversion")
 local loaddata=io.loaddata
 local savedata=io.savedata
 local remove=os.remove
if context then
  local xmlconvert=xml.convert
  local xmlfirst=xml.first
  function otfsvg.filterglyph(entry,index)
   local d=entry.data
   if gzip.compressed(d) then
    d=gzip.decompress(d) or d
   end
   local svg=xmlconvert(d)
   local root=svg and xmlfirst(svg,"/svg[@id='glyph"..index.."']")
   local data=root and tostring(root)
   return data
  end
else
  function otfsvg.filterglyph(entry,index) 
   return entry.data
  end
end
 local runner=sandbox and sandbox.registerrunner {
  name="otfsvg",
  program="inkscape",
  method="pipeto",
  template="--export-area-drawing --shell > temp-otf-svg-shape.log",
  reporter=report_svg,
 }
 if not runner then
  runner=function()
   return io.popen("inkscape --export-area-drawing --shell > temp-otf-svg-shape.log","w")
  end
 end
 local new=nil
 local function inkscapeformat(suffix)
  if new==nil then
   new=os.resultof("inkscape --version") or ""
   new=new=="" or not find(new,"Inkscape%s*0")
  end
  return new and "filename" or suffix
 end
 function otfsvg.topdf(svgshapes,tfmdata)
  local pdfshapes={}
  local inkscape=runner()
  if inkscape then
   local descriptions=tfmdata.descriptions
   local nofshapes=#svgshapes
   local s_format=inkscapeformat("pdf") 
   local f_svgfile=formatters["temp-otf-svg-shape-%i.svg"]
   local f_pdffile=formatters["temp-otf-svg-shape-%i.pdf"]
   local f_convert=formatters[new and "file-open:%s; export-%s:%s; export-do\n" or "%s --export-%s=%s\n"]
   local filterglyph=otfsvg.filterglyph
   local nofdone=0
   local processed={}
   report_svg("processing %i svg containers",nofshapes)
   statistics.starttiming()
   for i=1,nofshapes do
    local entry=svgshapes[i]
    for index=entry.first,entry.last do
     local data=filterglyph(entry,index)
     if data and data~="" then
      local svgfile=f_svgfile(index)
      local pdffile=f_pdffile(index)
      savedata(svgfile,data)
      inkscape:write(f_convert(svgfile,s_format,pdffile))
      processed[index]=true
      nofdone=nofdone+1
      if nofdone%25==0 then
       report_svg("%i shapes submitted",nofdone)
      end
     end
    end
   end
   if nofdone%25~=0 then
    report_svg("%i shapes submitted",nofdone)
   end
   report_svg("processing can be going on for a while")
   inkscape:write("quit\n")
   inkscape:close()
   report_svg("processing %i pdf results",nofshapes)
   for index in next,processed do
    local svgfile=f_svgfile(index)
    local pdffile=f_pdffile(index)
    local pdfdata=loaddata(pdffile)
    if pdfdata and pdfdata~="" then
     pdfshapes[index]={
      data=pdfdata,
     }
    end
    remove(svgfile)
    remove(pdffile)
   end
   local characters=tfmdata.characters
   for k,v in next,characters do
    local d=descriptions[k]
    local i=d.index
    if i then
     local p=pdfshapes[i]
     if p then
      local w=d.width
      local l=d.boundingbox[1]
      local r=d.boundingbox[3]
      p.scale=(r-l)/w
      p.x=l
     end
    end
   end
   if not next(pdfshapes) then
    report_svg("there are no converted shapes, fix your setup")
   end
   statistics.stoptiming()
   if statistics.elapsedseconds then
    report_svg("svg conversion time %s",statistics.elapsedseconds() or "-")
   end
  end
  return pdfshapes
 end
end
local function initializesvg(tfmdata,kind,value) 
 if value and otf.svgenabled then
  local svg=tfmdata.properties.svg
  local hash=svg and svg.hash
  local timestamp=svg and svg.timestamp
  if not hash then
   return
  end
  local pdffile=containers.read(otf.pdfcache,hash)
  local pdfshapes=pdffile and pdffile.pdfshapes
  if not pdfshapes or pdffile.timestamp~=timestamp or not next(pdfshapes) then
   local svgfile=containers.read(otf.svgcache,hash)
   local svgshapes=svgfile and svgfile.svgshapes
   pdfshapes=svgshapes and otfsvg.topdf(svgshapes,tfmdata,otf.pdfcache.writable,hash) or {}
   containers.write(otf.pdfcache,hash,{
    pdfshapes=pdfshapes,
    timestamp=timestamp,
   })
  end
  pdftovirtual(tfmdata,pdfshapes,"svg")
  return true
 end
end
otfregister {
 name="svg",
 description="svg glyphs",
 manipulators={
  base=initializesvg,
  node=initializesvg,
 }
}
local otfpng=otf.png or {}
otf.png=otfpng
otf.pngenabled=true
do
 local report_png=logs.reporter("fonts","png conversion")
 local loaddata=io.loaddata
 local savedata=io.savedata
 local remove=os.remove
 local runner=sandbox and sandbox.registerrunner {
  name="otfpng",
  program="gm",
  template="convert -quality 100 temp-otf-png-shape.png temp-otf-png-shape.pdf > temp-otf-svg-shape.log",
 }
 if not runner then
  runner=function()
   return os.execute("gm convert -quality 100 temp-otf-png-shape.png temp-otf-png-shape.pdf > temp-otf-svg-shape.log")
  end
 end
 function otfpng.topdf(pngshapes)
  local pdfshapes={}
  local pngfile="temp-otf-png-shape.png"
  local pdffile="temp-otf-png-shape.pdf"
  local nofdone=0
  local indices=sortedkeys(pngshapes) 
  local nofindices=#indices
  report_png("processing %i png containers",nofindices)
  statistics.starttiming()
  for i=1,nofindices do
   local index=indices[i]
   local entry=pngshapes[index]
   local data=entry.data 
   local x=entry.x
   local y=entry.y
   savedata(pngfile,data)
   runner()
   pdfshapes[index]={
    x=x~=0 and x or nil,
    y=y~=0 and y or nil,
    data=loaddata(pdffile),
   }
   nofdone=nofdone+1
   if nofdone%100==0 then
    report_png("%i shapes processed",nofdone)
   end
  end
  report_png("processing %i pdf results",nofindices)
  remove(pngfile)
  remove(pdffile)
  statistics.stoptiming()
  if statistics.elapsedseconds then
   report_png("png conversion time %s",statistics.elapsedseconds() or "-")
  end
  return pdfshapes
 end
end
local function initializepng(tfmdata,kind,value) 
 if value and otf.pngenabled then
  local png=tfmdata.properties.png
  local hash=png and png.hash
  local timestamp=png and png.timestamp
  if not hash then
   return
  end
  local pdffile=containers.read(otf.pdfcache,hash)
  local pdfshapes=pdffile and pdffile.pdfshapes
  if not pdfshapes or pdffile.timestamp~=timestamp then
   local pngfile=containers.read(otf.pngcache,hash)
   local pngshapes=pngfile and pngfile.pngshapes
   pdfshapes=pngshapes and otfpng.topdf(pngshapes) or {}
   containers.write(otf.pdfcache,hash,{
    pdfshapes=pdfshapes,
    timestamp=timestamp,
   })
  end
  pdftovirtual(tfmdata,pdfshapes,"png")
  return true
 end
end
otfregister {
 name="sbix",
 description="sbix glyphs",
 manipulators={
  base=initializepng,
  node=initializepng,
 }
}
otfregister {
 name="cblc",
 description="cblc glyphs",
 manipulators={
  base=initializepng,
  node=initializepng,
 }
}
if context then
 local function initializecolor(tfmdata,kind,value)
  if value=="auto" then
   return
    initializeoverlay(tfmdata,kind,value) or
    initializesvg(tfmdata,kind,value) or
    initializepng(tfmdata,kind,value)
  elseif value=="overlay" then
   return initializeoverlay(tfmdata,kind,value)
  elseif value=="svg" then
   return initializesvg(tfmdata,kind,value)
  elseif value=="png" or value=="bitmap" then
   return initializepng(tfmdata,kind,value)
  else
  end
 end
 otfregister {
  name="color",
  description="color glyphs",
  manipulators={
   base=initializecolor,
   node=initializecolor,
  }
 }
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-ocl”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otc” 582295d3d1e44cd4a31e8bbc1156f7c1] ---

if not modules then modules={} end modules ['font-otc']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local insert,sortedkeys,sortedhash,tohash=table.insert,table.sortedkeys,table.sortedhash,table.tohash
local type,next,tonumber=type,next,tonumber
local lpegmatch=lpeg.match
local utfbyte,utflen=utf.byte,utf.len
local sortedhash=table.sortedhash
local trace_loading=false  trackers.register("otf.loading",function(v) trace_loading=v end)
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
local registerotffeature=otf.features.register
local setmetatableindex=table.setmetatableindex
local fonthelpers=fonts.helpers
local checkmerge=fonthelpers.checkmerge
local checkflags=fonthelpers.checkflags
local checksteps=fonthelpers.checksteps
local normalized={
 substitution="substitution",
 single="substitution",
 ligature="ligature",
 alternate="alternate",
 multiple="multiple",
 kern="kern",
 pair="pair",
 single="single",
 chainsubstitution="chainsubstitution",
 chainposition="chainposition",
}
local types={
 substitution="gsub_single",
 ligature="gsub_ligature",
 alternate="gsub_alternate",
 multiple="gsub_multiple",
 kern="gpos_pair",
 pair="gpos_pair",
 single="gpos_single",
 chainsubstitution="gsub_contextchain",
 chainposition="gpos_contextchain",
}
local names={
 gsub_single="gsub",
 gsub_multiple="gsub",
 gsub_alternate="gsub",
 gsub_ligature="gsub",
 gsub_context="gsub",
 gsub_contextchain="gsub",
 gsub_reversecontextchain="gsub",
 gpos_single="gpos",
 gpos_pair="gpos",
 gpos_cursive="gpos",
 gpos_mark2base="gpos",
 gpos_mark2ligature="gpos",
 gpos_mark2mark="gpos",
 gpos_context="gpos",
 gpos_contextchain="gpos",
}
setmetatableindex(types,function(t,k) t[k]=k return k end) 
local everywhere={ ["*"]={ ["*"]=true } } 
local noflags={ false,false,false,false }
local function getrange(sequences,category)
 local count=#sequences
 local first=nil
 local last=nil
 for i=1,count do
  local t=sequences[i].type
  if t and names[t]==category then
   if not first then
    first=i
   end
   last=i
  end
 end
 return first or 1,last or count
end
local function validspecification(specification,name)
 local dataset=specification.dataset
 if dataset then
 elseif specification[1] then
  dataset=specification
  specification={ dataset=dataset }
 else
  dataset={ { data=specification.data } }
  specification.data=nil
  specification.coverage=dataset
  specification.dataset=dataset
 end
 local first=dataset[1]
 if first then
  first=first.data
 end
 if not first then
  report_otf("invalid feature specification, no dataset")
  return
 end
 if type(name)~="string" then
  name=specification.name or first.name
 end
 if type(name)~="string" then
  report_otf("invalid feature specification, no name")
  return
 end
 local n=#dataset
 if n>0 then
  for i=1,n do
   setmetatableindex(dataset[i],specification)
  end
  return specification,name
 end
end
local function addfeature(data,feature,specifications)
 if not specifications then
  report_otf("missing specification")
  return
 end
 local descriptions=data.descriptions
 local resources=data.resources
 local features=resources.features
 local sequences=resources.sequences
 if not features or not sequences then
  report_otf("missing specification")
  return
 end
 local alreadydone=resources.alreadydone
 if not alreadydone then
  alreadydone={}
  resources.alreadydone=alreadydone
 end
 if alreadydone[specifications] then
  return
 else
  alreadydone[specifications]=true
 end
 local fontfeatures=resources.features or everywhere
 local unicodes=resources.unicodes
 local splitter=lpeg.splitter(" ",unicodes)
 local done=0
 local skip=0
 local aglunicodes=false
 local privateslot=fonthelpers.privateslot
 local specifications=validspecification(specifications,feature)
 if not specifications then
  return
 end
 local p=lpeg.P("P")*(lpeg.patterns.hexdigit^1/function(s) return tonumber(s,16) end)*lpeg.P(-1)
 local function tounicode(code)
  if not code then
   return
  end
  if type(code)=="number" then
   return code
  end
  local u=unicodes[code]
  if u then
   return u
  end
  if utflen(code)==1 then
   u=utfbyte(code)
   if u then
    return u
   end
  end
  if privateslot then
   u=privateslot(code) 
   if u then
    return u
   end
  end
  local u=lpegmatch(p,code)
  if u then
   return u
  end
  if not aglunicodes then
   aglunicodes=fonts.encodings.agl.unicodes 
  end
  local u=aglunicodes[code]
  if u then
   return u
  end
 end
 local coverup=otf.coverup
 local coveractions=coverup.actions
 local stepkey=coverup.stepkey
 local register=coverup.register
 local function prepare_substitution(list,featuretype,nocheck)
  local coverage={}
  local cover=coveractions[featuretype]
  for code,replacement in next,list do
   local unicode=tounicode(code)
   local description=descriptions[unicode]
   if not nocheck and not description then
    skip=skip+1
   else
    if type(replacement)=="table" then
     replacement=replacement[1]
    end
    replacement=tounicode(replacement)
    if replacement and (nocheck or descriptions[replacement]) then
     cover(coverage,unicode,replacement)
     done=done+1
    else
     skip=skip+1
    end
   end
  end
  return coverage
 end
 local function prepare_alternate(list,featuretype,nocheck)
  local coverage={}
  local cover=coveractions[featuretype]
  for code,replacement in next,list do
   local unicode=tounicode(code)
   local description=descriptions[unicode]
   if not nocheck and not description then
    skip=skip+1
   elseif type(replacement)=="table" then
    local r={}
    for i=1,#replacement do
     local u=tounicode(replacement[i])
     r[i]=(nocheck or descriptions[u]) and u or unicode
    end
    cover(coverage,unicode,r)
    done=done+1
   else
    local u=tounicode(replacement)
    if u then
     cover(coverage,unicode,{ u })
     done=done+1
    else
     skip=skip+1
    end
   end
  end
  return coverage
 end
 local function prepare_multiple(list,featuretype,nocheck)
  local coverage={}
  local cover=coveractions[featuretype]
  for code,replacement in next,list do
   local unicode=tounicode(code)
   local description=descriptions[unicode]
   if not nocheck and not description then
    skip=skip+1
   elseif type(replacement)=="table" then
    local r={}
    local n=0
    for i=1,#replacement do
     local u=tounicode(replacement[i])
     if nocheck or descriptions[u] then
      n=n+1
      r[n]=u
     end
    end
    if n>0 then
     cover(coverage,unicode,r)
     done=done+1
    else
     skip=skip+1
    end
   else
    local u=tounicode(replacement)
    if u then
     cover(coverage,unicode,{ u })
     done=done+1
    else
     skip=skip+1
    end
   end
  end
  return coverage
 end
 local function prepare_ligature(list,featuretype,nocheck)
  local coverage={}
  local cover=coveractions[featuretype]
  for code,ligature in next,list do
   local unicode=tounicode(code)
   local description=descriptions[unicode]
   if not nocheck and not description then
    skip=skip+1
   else
    if type(ligature)=="string" then
     ligature={ lpegmatch(splitter,ligature) }
    end
    local present=true
    for i=1,#ligature do
     local l=ligature[i]
     local u=tounicode(l)
     if nocheck or descriptions[u] then
      ligature[i]=u
     else
      present=false
      break
     end
    end
    if present then
     cover(coverage,unicode,ligature)
     done=done+1
    else
     skip=skip+1
    end
   end
  end
  return coverage
 end
 local function resetspacekerns()
  data.properties.hasspacekerns=true
  data.resources .spacekerns=nil
 end
 local function prepare_kern(list,featuretype)
  local coverage={}
  local cover=coveractions[featuretype]
  local isspace=false
  for code,replacement in next,list do
   local unicode=tounicode(code)
   local description=descriptions[unicode]
   if description and type(replacement)=="table" then
    local r={}
    for k,v in next,replacement do
     local u=tounicode(k)
     if u then
      r[u]=v
      if u==32 then
       isspace=true
      end
     end
    end
    if next(r) then
     cover(coverage,unicode,r)
     done=done+1
     if unicode==32 then
      isspace=true
     end
    else
     skip=skip+1
    end
   else
    skip=skip+1
   end
  end
  if isspace then
   resetspacekerns()
  end
  return coverage
 end
 local function prepare_pair(list,featuretype)
  local coverage={}
  local cover=coveractions[featuretype]
  if cover then
   for code,replacement in next,list do
    local unicode=tounicode(code)
    local description=descriptions[unicode]
    if description and type(replacement)=="table" then
     local r={}
     for k,v in next,replacement do
      local u=tounicode(k)
      if u then
       r[u]=v
       if u==32 then
        isspace=true
       end
      end
     end
     if next(r) then
      cover(coverage,unicode,r)
      done=done+1
      if unicode==32 then
       isspace=true
      end
     else
      skip=skip+1
     end
    else
     skip=skip+1
    end
   end
   if isspace then
    resetspacekerns()
   end
  else
   report_otf("unknown cover type %a",featuretype)
  end
  return coverage
 end
 local prepare_single=prepare_pair 
 local function hassteps(lookups)
  if lookups then
   for i=1,#lookups do
    local l=lookups[i]
    if l then
     for j=1,#l do
      local l=l[j]
      if l then
       local n=l.nofsteps
       if not n then
        return true
       elseif n>0 then
        return true
       end
      end
     end
    end
   end
  end
  return false
 end
 local function prepare_chain(list,featuretype,sublookups,nocheck)
  local rules=list.rules
  local coverage={}
  if rules then
   local rulehash={}
   local rulesize=0
   local lookuptype=types[featuretype]
   for nofrules=1,#rules do
    local rule=rules[nofrules]
    local current=rule.current
    local before=rule.before
    local after=rule.after
    local replacements=rule.replacements or false
    local sequence={}
    local nofsequences=0
    if before then
     for n=1,#before do
      nofsequences=nofsequences+1
      sequence[nofsequences]=before[n]
     end
    end
    local start=nofsequences+1
    for n=1,#current do
     nofsequences=nofsequences+1
     sequence[nofsequences]=current[n]
    end
    local stop=nofsequences
    if after then
     for n=1,#after do
      nofsequences=nofsequences+1
      sequence[nofsequences]=after[n]
     end
    end
    local lookups=rule.lookups or false
    local subtype=nil
    if lookups and sublookups then
     local l={}
     for k,v in sortedhash(lookups) do
      local t=type(v)
      if t=="table" then
       for i=1,#v do
        local vi=v[i]
        if type(vi)~="table" then
         v[i]={ vi }
        end
       end
       l[k]=v
      elseif t=="number" then
       local lookup=sublookups[v]
       if lookup then
        l[k]={ lookup }
        if not subtype then
         subtype=lookup.type
        end
       elseif v==0 then
        l[k]={ { type="gsub_remove",nosteps=true } }
       else
        l[k]=false 
       end
      else
       l[k]=false 
      end
     end
     if nocheck then
      rule.lookups=l 
     end
     lookups=l
    end
    if nofsequences>0 then
     if hassteps(lookups) then
      local hashed={}
      for i=1,nofsequences do
       local t={}
       local s=sequence[i]
       for i=1,#s do
        local u=tounicode(s[i])
        if u then
         t[u]=true
        end
       end
       hashed[i]=t
      end
      sequence=hashed
      rulesize=rulesize+1
      rulehash[rulesize]={
       nofrules,
       lookuptype,
       sequence,
       start,
       stop,
       lookups,
       replacements,
       subtype,
      }
      for unic in sortedhash(sequence[start]) do
       local cu=coverage[unic]
       if not cu then
        coverage[unic]=rulehash 
       end
      end
      sequence.n=nofsequences
     else
     end
    end
   end
   rulehash.n=rulesize
  end
  return coverage
 end
 local dataset=specifications.dataset
 local function report(name,category,position,first,last,sequences)
  report_otf("injecting name %a of category %a at position %i in [%i,%i] of [%i,%i]",
   name,category,position,first,last,1,#sequences)
 end
 local function inject(specification,sequences,sequence,first,last,category,name)
  local position=specification.position or false
  if not position then
   position=specification.prepend
   if position==true then
    if trace_loading then
     report(name,category,first,first,last,sequences)
    end
    insert(sequences,first,sequence)
    return
   end
  end
  if not position then
   position=specification.append
   if position==true then
    if trace_loading then
     report(name,category,last+1,first,last,sequences)
    end
    insert(sequences,last+1,sequence)
    return
   end
  end
  local kind=type(position)
  if kind=="string" then
   local index=false
   for i=first,last do
    local s=sequences[i]
    local f=s.features
    if f then
     for k in sortedhash(f) do 
      if k==position then
       index=i
       break
      end
     end
     if index then
      break
     end
    end
   end
   if index then
    position=index
   else
    position=last+1
   end
  elseif kind=="number" then
   if position<0 then
    position=last-position+1
   end
   if position>last then
    position=last+1
   elseif position<first then
    position=first
   end
  else
   position=last+1
  end
  if trace_loading then
   report(name,category,position,first,last,sequences)
  end
  insert(sequences,position,sequence)
 end
 for s=1,#dataset do
  local specification=dataset[s]
  local valid=specification.valid 
  local feature=specification.name or feature
  if not feature or feature=="" then
   report_otf("no valid name given for extra feature")
  elseif not valid or valid(data,specification,feature) then 
   local initialize=specification.initialize
   if initialize then
    specification.initialize=initialize(specification,data) and initialize or nil
   end
   local askedfeatures=specification.features or everywhere
   local askedsteps=specification.steps or specification.subtables or { specification.data } or {}
   local featuretype=specification.type or "substitution"
   local featureaction=false
   local featureflags=specification.flags or noflags
   local nocheck=specification.nocheck
   local mapping=specification.mapping
   local featureorder=specification.order or { feature }
   local featurechain=(featuretype=="chainsubstitution" or featuretype=="chainposition") and 1 or 0
   local nofsteps=0
   local steps={}
   local sublookups=specification.lookups
   local category=nil
   local steptype=nil
   local sequence=nil
   if fonts.handlers.otf.handlers[featuretype] then
    featureaction=true 
   else
    featuretype=normalized[specification.type or "substitution"] or "substitution"
   end
   checkflags(specification,resources)
   for k,v in next,askedfeatures do
    if v[1] then
     askedfeatures[k]=tohash(v)
    end
   end
   if featureflags[1] then featureflags[1]="mark" end
   if featureflags[2] then featureflags[2]="ligature" end
   if featureflags[3] then featureflags[3]="base" end
   if featureaction then
    category="gsub"
    sequence={
     features={ [feature]=askedfeatures },
     flags=featureflags,
     name=feature,
     order=featureorder,
     type=featuretype,
     nofsteps=0,
    }
   else
    if sublookups then
     local s={}
     for i=1,#sublookups do
      local specification=sublookups[i]
      local askedsteps=specification.steps or specification.subtables or { specification.data } or {}
      local featuretype=normalized[specification.type or "substitution"] or "substitution"
      local featureflags=specification.flags or noflags
      local nofsteps=0
      local steps={}
      for i=1,#askedsteps do
       local list=askedsteps[i]
       local coverage=nil
       local format=nil
       if featuretype=="substitution" then
        coverage=prepare_substitution(list,featuretype,nocheck)
       elseif featuretype=="ligature" then
        coverage=prepare_ligature(list,featuretype,nocheck)
       elseif featuretype=="alternate" then
        coverage=prepare_alternate(list,featuretype,nocheck)
       elseif featuretype=="multiple" then
        coverage=prepare_multiple(list,featuretype,nocheck)
       elseif featuretype=="kern" or featuretype=="move" then
        format=featuretype
        coverage=prepare_kern(list,featuretype)
       elseif featuretype=="pair" then
        format="pair"
        coverage=prepare_pair(list,featuretype)
       elseif featuretype=="single" then
        format="single"
        coverage=prepare_single(list,featuretype)
       end
       if coverage and next(coverage) then
        nofsteps=nofsteps+1
        steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
       end
      end
      checkmerge(specification)
      checksteps(specification)
      s[i]={
       [stepkey]=steps,
       nofsteps=nofsteps,
       flags=featureflags,
       type=types[featuretype],
      }
     end
     sublookups=s
    end
    for i=1,#askedsteps do
     local list=askedsteps[i]
     local coverage=nil
     local format=nil
     if featuretype=="substitution" then
      category="gsub"
      coverage=(mapping and list) or prepare_substitution(list,featuretype,nocheck)
     elseif featuretype=="ligature" then
      category="gsub"
      coverage=prepare_ligature(list,featuretype,nocheck)
     elseif featuretype=="alternate" then
      category="gsub"
      coverage=prepare_alternate(list,featuretype,nocheck)
     elseif featuretype=="multiple" then
      category="gsub"
      coverage=prepare_multiple(list,featuretype,nocheck)
     elseif featuretype=="kern" or featuretype=="move" then
      category="gpos"
      format=featuretype
      coverage=prepare_kern(list,featuretype)
     elseif featuretype=="pair" then
      category="gpos"
      format="pair"
      coverage=prepare_pair(list,featuretype)
     elseif featuretype=="single" then
      category="gpos"
      format="single"
      coverage=prepare_single(list,featuretype)
     elseif featuretype=="chainsubstitution" then
      category="gsub"
      coverage=prepare_chain(list,featuretype,sublookups,nocheck)
     elseif featuretype=="chainposition" then
      category="gpos"
      coverage=prepare_chain(list,featuretype,sublookups,nocheck)
     else
      report_otf("not registering feature %a, unknown category",feature)
      return
     end
     if coverage and next(coverage) then
      nofsteps=nofsteps+1
      steps[nofsteps]=register(coverage,featuretype,format,feature,nofsteps,descriptions,resources)
     end
    end
    if nofsteps>0 then
     sequence={
      chain=featurechain,
      features={ [feature]=askedfeatures },
      flags=featureflags,
      name=feature,
      order=featureorder,
      [stepkey]=steps,
      nofsteps=nofsteps,
      type=types[featuretype],
     }
    end
   end
   if sequence then
    checkflags(sequence,resources)
    checkmerge(sequence)
    checksteps(sequence)
    local first,last=getrange(sequences,category)
    inject(specification,sequences,sequence,first,last,category,feature)
    local features=fontfeatures[category]
    if not features then
     features={}
     fontfeatures[category]=features
    end
    local k=features[feature]
    if not k then
     k={}
     features[feature]=k
    end
    for script,languages in next,askedfeatures do
     local kk=k[script]
     if not kk then
      kk={}
      k[script]=kk
     end
     for language,value in next,languages do
      kk[language]=value
     end
    end
   end
  end
 end
 if trace_loading then
  report_otf("registering feature %a, affected glyphs %a, skipped glyphs %a",feature,done,skip)
 end
end
otf.enhancers.addfeature=addfeature
local extrafeatures={}
local knownfeatures={}
function otf.addfeature(name,specification)
 if type(name)=="table" then
  specification=name
 end
 if type(specification)~="table" then
  report_otf("invalid feature specification, no valid table")
  return
 end
 specification,name=validspecification(specification,name)
 if name and specification then
  local slot=knownfeatures[name]
  if not slot then
   slot=#extrafeatures+1
   knownfeatures[name]=slot
  elseif specification.overload==false then
   slot=#extrafeatures+1
   knownfeatures[name]=slot
  else
  end
  specification.name=name 
  extrafeatures[slot]=specification
 end
end
local function enhance(data,filename,raw)
 for slot=1,#extrafeatures do
  local specification=extrafeatures[slot]
  addfeature(data,specification.name,specification)
 end
end
otf.enhancers.enhance=enhance
otf.enhancers.register("check extra features",enhance)

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-otc”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-onr” 6d161533f3437435e12a0ad64866df44] ---

if not modules then modules={} end modules ['font-onr']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local fonts,logs,trackers,resolvers=fonts,logs,trackers,resolvers
local next,type,tonumber,rawset=next,type,tonumber,rawset
local match,lower,gsub,strip,find=string.match,string.lower,string.gsub,string.strip,string.find
local char,byte,sub=string.char,string.byte,string.sub
local abs=math.abs
local bxor,rshift=bit32.bxor,bit32.rshift
local P,S,R,V,Cmt,C,Ct,Cs,Carg,Cf,Cg,Cc=lpeg.P,lpeg.S,lpeg.R,lpeg.V,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cf,lpeg.Cg,lpeg.Cc
local lpegmatch,patterns=lpeg.match,lpeg.patterns
local trace_indexing=false  trackers.register("afm.indexing",function(v) trace_indexing=v end)
local trace_loading=false  trackers.register("afm.loading",function(v) trace_loading=v end)
local report_afm=logs.reporter("fonts","afm loading")
local report_pfb=logs.reporter("fonts","pfb loading")
local handlers=fonts.handlers
local afm=handlers.afm or {}
handlers.afm=afm
local readers=afm.readers or {}
afm.readers=readers
afm.version=1.513
local get_indexes,get_shapes
do
 local decrypt
 do
  local r,c1,c2,n=0,0,0,0
  local function step(c)
   local cipher=byte(c)
   local plain=bxor(cipher,rshift(r,8))
   r=((cipher+r)*c1+c2)%65536
   return char(plain)
  end
  decrypt=function(binary,initial,seed)
   r,c1,c2,n=initial,52845,22719,seed
   binary=gsub(binary,".",step)
   return sub(binary,n+1)
  end
 end
 local charstrings=P("/CharStrings")
 local subroutines=P("/Subrs")
 local encoding=P("/Encoding")
 local dup=P("dup")
 local put=P("put")
 local array=P("array")
 local name=P("/")*C((R("az","AZ","09")+S("-_."))^1)
 local digits=R("09")^1
 local cardinal=digits/tonumber
 local spaces=P(" ")^1
 local spacing=patterns.whitespace^0
 local routines,vector,chars,n,m
 local initialize=function(str,position,size)
  n=0
  m=size
  return position+1
 end
 local setroutine=function(str,position,index,size,filename)
  if routines[index] then
   return false
  end
  local forward=position+size
  local stream=decrypt(sub(str,position+1,forward),4330,4)
  routines[index]={ byte(stream,1,#stream) }
  n=n+1
  if n>=m then
   return #str
  end
  return forward+1
 end
 local setvector=function(str,position,name,size,filename)
  local forward=position+tonumber(size)
  if n>=m then
   return #str
  elseif forward<#str then
   if n==0 and name~=".notdef" then
    report_pfb("reserving .notdef at index 0 in %a",filename) 
    n=n+1
   end
   vector[n]=name
   n=n+1
   return forward
  else
   return #str
  end
 end
 local setshapes=function(str,position,name,size,filename)
  local forward=position+tonumber(size)
  local stream=sub(str,position+1,forward)
  if n>m then
   return #str
  elseif forward<#str then
   if n==0 and name~=".notdef" then
    report_pfb("reserving .notdef at index 0 in %a",filename) 
    n=n+1
   end
   vector[n]=name
   n=n+1
   chars [n]=decrypt(stream,4330,4)
   return forward
  else
   return #str
  end
 end
 local p_rd=spacing*(P("RD")+P("-|"))
 local p_np=spacing*(P("NP")+P("|"))
 local p_nd=spacing*(P("ND")+P("|"))
 local p_filterroutines=
  (1-subroutines)^0*subroutines*spaces*Cmt(cardinal,initialize)*(Cmt(cardinal*spaces*cardinal*p_rd*Carg(1),setroutine)*p_np+(1-p_nd))^1
 local p_filtershapes=
  (1-charstrings)^0*charstrings*spaces*Cmt(cardinal,initialize)*(Cmt(name*spaces*cardinal*p_rd*Carg(1),setshapes)*p_nd+P(1))^1
 local p_filternames=Ct (
  (1-charstrings)^0*charstrings*spaces*Cmt(cardinal,initialize)*(Cmt(name*spaces*cardinal*Carg(1),setvector)+P(1))^1
 )
 local p_filterencoding=(1-encoding)^0*encoding*spaces*digits*spaces*array*(1-dup)^0*Cf(
   Ct("")*Cg(spacing*dup*spaces*cardinal*spaces*name*spaces*put)^1
,rawset)
 local key=spacing*P("/")*R("az","AZ")
 local str=spacing*Cs { (P("(")/"")*((1-P("\\(")-P("\\)")-S("()"))+V(1))^0*(P(")")/"") }
 local num=spacing*(R("09")+S("+-."))^1/tonumber
 local arr=spacing*Ct (S("[{")*(num)^0*spacing*S("]}"))
 local boo=spacing*(P("true")*Cc(true)+P("false")*Cc(false))
 local nam=spacing*P("/")*Cs(R("az","AZ")^1)
 local p_filtermetadata=(
  P("/")*Carg(1)*((
   C("version")*str+C("Copyright")*str+C("Notice")*str+C("FullName")*str+C("FamilyName")*str+C("Weight")*str+C("ItalicAngle")*num+C("isFixedPitch")*boo+C("UnderlinePosition")*num+C("UnderlineThickness")*num+C("FontName")*nam+C("FontMatrix")*arr+C("FontBBox")*arr
  ) )/function(t,k,v) t[lower(k)]=v end+P(1)
 )^0*Carg(1)
 local function loadpfbvector(filename,shapestoo,streams)
  local data=io.loaddata(resolvers.findfile(filename))
  if not data then
   report_pfb("no data in %a",filename)
   return
  end
  if not (find(data,"!PS-AdobeFont-",1,true) or find(data,"%!FontType1",1,true)) then
   report_pfb("no font in %a",filename)
   return
  end
  local ascii,binary=match(data,"(.*)eexec%s+......(.*)")
  if not binary then
   report_pfb("no binary data in %a",filename)
   return
  end
  binary=decrypt(binary,55665,4)
  local names={}
  local encoding=lpegmatch(p_filterencoding,ascii)
  local metadata=lpegmatch(p_filtermetadata,ascii,1,{})
  local glyphs={}
  routines,vector,chars={},{},{}
  if shapestoo or streams then
   lpegmatch(p_filterroutines,binary,1,filename)
   lpegmatch(p_filtershapes,binary,1,filename)
   local data={
    dictionaries={
     {
      charstrings=chars,
      charset=vector,
      subroutines=routines,
     }
    },
   }
   fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,"cff",streams,true)
  else
   lpegmatch(p_filternames,binary,1,filename)
  end
  names=vector
  routines,vector,chars=nil,nil,nil
  return names,encoding,glyphs,metadata
 end
 local pfb=handlers.pfb or {}
 handlers.pfb=pfb
 pfb.loadvector=loadpfbvector
 get_indexes=function(data,pfbname)
  local vector=loadpfbvector(pfbname)
  if vector then
   local characters=data.characters
   if trace_loading then
    report_afm("getting index data from %a",pfbname)
   end
   for index=0,#vector do 
    local name=vector[index]
    local char=characters[name]
    if char then
     if trace_indexing then
      report_afm("glyph %a has index %a",name,index)
     end
     char.index=index
    else
     if trace_indexing then
      report_afm("glyph %a has index %a but no data",name,index)
     end
    end
   end
  end
 end
 get_shapes=function(pfbname)
  local vector,encoding,glyphs=loadpfbvector(pfbname,true)
  return glyphs
 end
end
local spacer=patterns.spacer
local whitespace=patterns.whitespace
local lineend=patterns.newline
local spacing=spacer^0
local number=spacing*S("+-")^-1*(R("09")+S("."))^1/tonumber
local name=spacing*C((1-whitespace)^1)
local words=spacing*((1-lineend)^1/strip)
local rest=(1-lineend)^0
local fontdata=Carg(1)
local semicolon=spacing*P(";")
local plus=spacing*P("plus")*number
local minus=spacing*P("minus")*number
local function addkernpair(data,one,two,value)
 local chr=data.characters[one]
 if chr then
  local kerns=chr.kerns
  if kerns then
   kerns[two]=tonumber(value)
  else
   chr.kerns={ [two]=tonumber(value) }
  end
 end
end
local p_kernpair=(fontdata*P("KPX")*name*name*number)/addkernpair
local chr=false
local ind=0
local function start(data,version)
 data.metadata.afmversion=version
 ind=0
 chr={}
end
local function stop()
 ind=0
 chr=false
end
local function setindex(i)
 if i<0 then
  ind=ind+1 
 else
  ind=i
 end
 chr={
  index=ind
 }
end
local function setwidth(width)
 chr.width=width
end
local function setname(data,name)
 data.characters[name]=chr
end
local function setboundingbox(boundingbox)
 chr.boundingbox=boundingbox
end
local function setligature(plus,becomes)
 local ligatures=chr.ligatures
 if ligatures then
  ligatures[plus]=becomes
 else
  chr.ligatures={ [plus]=becomes }
 end
end
local p_charmetric=((
 P("C")*number/setindex+P("WX")*number/setwidth+P("N")*fontdata*name/setname+P("B")*Ct((number)^4)/setboundingbox+P("L")*(name)^2/setligature
  )*semicolon )^1
local p_charmetrics=P("StartCharMetrics")*number*(p_charmetric+(1-P("EndCharMetrics")))^0*P("EndCharMetrics")
local p_kernpairs=P("StartKernPairs")*number*(p_kernpair+(1-P("EndKernPairs"  )))^0*P("EndKernPairs"  )
local function set_1(data,key,a)  data.metadata[lower(key)]=a     end
local function set_2(data,key,a,b)   data.metadata[lower(key)]={ a,b } end
local function set_3(data,key,a,b,c) data.metadata[lower(key)]={ a,b,c } end
local p_parameters=P(false)+fontdata*((P("FontName")+P("FullName")+P("FamilyName"))/lower)*words/function(data,key,value)
  data.metadata[key]=value
 end+fontdata*((P("Weight")+P("Version"))/lower)*name/function(data,key,value)
  data.metadata[key]=value
 end+fontdata*P("IsFixedPitch")*name/function(data,pitch)
  data.metadata.monospaced=toboolean(pitch,true)
 end+fontdata*P("FontBBox")*Ct(number^4)/function(data,boundingbox)
  data.metadata.boundingbox=boundingbox
  end+fontdata*((P("CharWidth")+P("CapHeight")+P("XHeight")+P("Descender")+P("Ascender")+P("ItalicAngle"))/lower)*number/function(data,key,value)
  data.metadata[key]=value
 end+P("Comment")*spacing*(P(false)+(fontdata*C("DESIGNSIZE")*number*rest)/set_1 
+(fontdata*C("TFM designsize")*number*rest)/set_1+(fontdata*C("DesignSize")*number*rest)/set_1+(fontdata*C("CODINGSCHEME")*words*rest)/set_1 
+(fontdata*C("CHECKSUM")*number*words*rest)/set_1 
+(fontdata*C("SPACE")*number*plus*minus*rest)/set_3 
+(fontdata*C("QUAD")*number*rest)/set_1 
+(fontdata*C("EXTRASPACE")*number*rest)/set_1 
+(fontdata*C("NUM")*number*number*number*rest)/set_3 
+(fontdata*C("DENOM")*number*number*rest)/set_2 
+(fontdata*C("SUP")*number*number*number*rest)/set_3 
+(fontdata*C("SUB")*number*number*rest)/set_2 
+(fontdata*C("SUPDROP")*number*rest)/set_1 
+(fontdata*C("SUBDROP")*number*rest)/set_1 
+(fontdata*C("DELIM")*number*number*rest)/set_2 
+(fontdata*C("AXISHEIGHT")*number*rest)/set_1 
 )
local fullparser=(P("StartFontMetrics")*fontdata*name/start )*(p_charmetrics+p_kernpairs+p_parameters+(1-P("EndFontMetrics")) )^0*(P("EndFontMetrics")/stop )
local infoparser=(P("StartFontMetrics")*fontdata*name/start )*(p_parameters+(1-P("EndFontMetrics")) )^0*(P("EndFontMetrics")/stop )
local function read(filename,parser)
 local afmblob=io.loaddata(filename)
 if afmblob then
  local data={
   resources={
    filename=resolvers.unresolve(filename),
    version=afm.version,
    creator="context mkiv",
   },
   properties={
    hasitalics=false,
   },
   goodies={},
   metadata={
    filename=file.removesuffix(file.basename(filename))
   },
   characters={
   },
   descriptions={
   },
  }
  if trace_loading then
   report_afm("parsing afm file %a",filename)
  end
  lpegmatch(parser,afmblob,1,data)
  return data
 else
  if trace_loading then
   report_afm("no valid afm file %a",filename)
  end
  return nil
 end
end
function readers.loadfont(afmname,pfbname)
 local data=read(resolvers.findfile(afmname),fullparser)
 if data then
  if not pfbname or pfbname=="" then
   pfbname=resolvers.findfile(file.replacesuffix(file.nameonly(afmname),"pfb"))
  end
  if pfbname and pfbname~="" then
   data.resources.filename=resolvers.unresolve(pfbname)
   get_indexes(data,pfbname)
   return data
  else 
   report_afm("no pfb file for %a",afmname)
  end
 end
end
function readers.loadshapes(filename)
 local fullname=resolvers.findfile(filename) or ""
 if fullname=="" then
  return {
   filename="not found: "..filename,
   glyphs={}
  }
 else
  return {
   filename=fullname,
   format="opentype",
   glyphs=get_shapes(fullname) or {},
   units=1000,
  }
 end
end
function readers.getinfo(filename)
 local data=read(resolvers.findfile(filename),infoparser)
 if data then
  return data.metadata
 end
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-onr”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-one” bd39d42055a44ca2002f8ddbbbbf27c3] ---

if not modules then modules={} end modules ['font-one']={
 version=1.001,
 optimize=true,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local fonts,logs,trackers,containers,resolvers=fonts,logs,trackers,containers,resolvers
local next,type,tonumber,rawget=next,type,tonumber,rawget
local match,gsub=string.match,string.gsub
local abs=math.abs
local P,S,R,Cmt,C,Ct,Cs,Carg=lpeg.P,lpeg.S,lpeg.R,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg
local lpegmatch,patterns=lpeg.match,lpeg.patterns
local sortedhash=table.sortedhash
local trace_features=false  trackers.register("afm.features",function(v) trace_features=v end)
local trace_indexing=false  trackers.register("afm.indexing",function(v) trace_indexing=v end)
local trace_loading=false  trackers.register("afm.loading",function(v) trace_loading=v end)
local trace_defining=false  trackers.register("fonts.defining",function(v) trace_defining=v end)
local report_afm=logs.reporter("fonts","afm loading")
local setmetatableindex=table.setmetatableindex
local derivetable=table.derive
local findbinfile=resolvers.findbinfile
local privateoffset=fonts.constructors and fonts.constructors.privateoffset or 0xF0000 
local definers=fonts.definers
local readers=fonts.readers
local constructors=fonts.constructors
local afm=constructors.handlers.afm
local pfb=constructors.handlers.pfb
local otf=fonts.handlers.otf
local otfreaders=otf.readers
local otfenhancers=otf.enhancers
local afmfeatures=constructors.features.afm
local registerafmfeature=afmfeatures.register
local afmenhancers=constructors.enhancers.afm
local registerafmenhancer=afmenhancers.register
afm.version=1.513 
afm.cache=containers.define("fonts","one",afm.version,true)
afm.autoprefixed=true 
afm.helpdata={}  
afm.syncspace=true 
local overloads=fonts.mappings.overloads
local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes
function afm.load(filename)
 filename=resolvers.findfile(filename,'afm') or ""
 if filename~="" and not fonts.names.ignoredfile(filename) then
  local name=file.removesuffix(file.basename(filename))
  local data=containers.read(afm.cache,name)
  local attr=lfs.attributes(filename)
  local size=attr and attr.size or 0
  local time=attr and attr.modification or 0
  local pfbfile=file.replacesuffix(name,"pfb")
  local pfbname=resolvers.findfile(pfbfile,"pfb") or ""
  if pfbname=="" then
   pfbname=resolvers.findfile(file.basename(pfbfile),"pfb") or ""
  end
  local pfbsize=0
  local pfbtime=0
  if pfbname~="" then
   local attr=lfs.attributes(pfbname)
   pfbsize=attr.size or 0
   pfbtime=attr.modification or 0
  end
  if not data or data.size~=size or data.time~=time or data.pfbsize~=pfbsize or data.pfbtime~=pfbtime then
   report_afm("reading %a",filename)
   data=afm.readers.loadfont(filename,pfbname)
   if data then
    afmenhancers.apply(data,filename)
    fonts.mappings.addtounicode(data,filename)
    otfreaders.stripredundant(data)
    otfreaders.pack(data)
    data.size=size
    data.time=time
    data.pfbsize=pfbsize
    data.pfbtime=pfbtime
    report_afm("saving %a in cache",name)
    data=containers.write(afm.cache,name,data)
    data=containers.read(afm.cache,name)
   end
  end
  if data then
   otfreaders.unpack(data)
   otfreaders.expand(data) 
   otfreaders.addunicodetable(data) 
   otfenhancers.apply(data,filename,data)
   if applyruntimefixes then
    applyruntimefixes(filename,data)
   end
  end
  return data
 end
end
local uparser=fonts.mappings.makenameparser() 
local function enhance_unify_names(data,filename)
 local unicodevector=fonts.encodings.agl.unicodes 
 local unicodes={}
 local names={}
 local private=data.private or privateoffset
 local descriptions=data.descriptions
 for name,blob in sortedhash(data.characters) do 
  local code=unicodevector[name] 
  if not code then
   code=lpegmatch(uparser,name)
   if type(code)~="number" then
    code=private
    private=private+1
    report_afm("assigning private slot %U for unknown glyph name %a",code,name)
   end
  end
  local index=blob.index
  unicodes[name]=code
  names[name]=index
  blob.name=name
  descriptions[code]={
   boundingbox=blob.boundingbox,
   width=blob.width,
   kerns=blob.kerns,
   index=index,
   name=name,
  }
 end
 for unicode,description in next,descriptions do
  local kerns=description.kerns
  if kerns then
   local krn={}
   for name,kern in next,kerns do
    local unicode=unicodes[name]
    if unicode then
     krn[unicode]=kern
    else
    end
   end
   description.kerns=krn
  end
 end
 data.characters=nil
 data.private=private
 local resources=data.resources
 local filename=resources.filename or file.removesuffix(file.basename(filename))
 resources.filename=resolvers.unresolve(filename) 
 resources.unicodes=unicodes 
 resources.marks={}
end
local everywhere={ ["*"]={ ["*"]=true } } 
local noflags={ false,false,false,false }
local function enhance_normalize_features(data)
 local ligatures=setmetatableindex("table")
 local kerns=setmetatableindex("table")
 local extrakerns=setmetatableindex("table")
 for u,c in next,data.descriptions do
  local l=c.ligatures
  local k=c.kerns
  local e=c.extrakerns
  if l then
   ligatures[u]=l
   for u,v in next,l do
    l[u]={ ligature=v }
   end
   c.ligatures=nil
  end
  if k then
   kerns[u]=k
   for u,v in next,k do
    k[u]=v 
   end
   c.kerns=nil
  end
  if e then
   extrakerns[u]=e
   for u,v in next,e do
    e[u]=v 
   end
   c.extrakerns=nil
  end
 end
 local features={
  gpos={},
  gsub={},
 }
 local sequences={
 }
 if next(ligatures) then
  features.gsub.liga=everywhere
  data.properties.hasligatures=true
  sequences[#sequences+1]={
   features={
    liga=everywhere,
   },
   flags=noflags,
   name="s_s_0",
   nofsteps=1,
   order={ "liga" },
   type="gsub_ligature",
   steps={
    {
     coverage=ligatures,
    },
   },
  }
 end
 if next(kerns) then
  features.gpos.kern=everywhere
  data.properties.haskerns=true
  sequences[#sequences+1]={
   features={
    kern=everywhere,
   },
   flags=noflags,
   name="p_s_0",
   nofsteps=1,
   order={ "kern" },
   type="gpos_pair",
   steps={
    {
     format="kern",
     coverage=kerns,
    },
   },
  }
 end
 if next(extrakerns) then
  features.gpos.extrakerns=everywhere
  data.properties.haskerns=true
  sequences[#sequences+1]={
   features={
    extrakerns=everywhere,
   },
   flags=noflags,
   name="p_s_1",
   nofsteps=1,
   order={ "extrakerns" },
   type="gpos_pair",
   steps={
    {
     format="kern",
     coverage=extrakerns,
    },
   },
  }
 end
 data.resources.features=features
 data.resources.sequences=sequences
end
local function enhance_fix_names(data)
 for k,v in next,data.descriptions do
  local n=v.name
  local r=overloads[n]
  if r then
   local name=r.name
   if trace_indexing then
    report_afm("renaming characters %a to %a",n,name)
   end
   v.name=name
   v.unicode=r.unicode
  end
 end
end
local addthem=function(rawdata,ligatures)
 if ligatures then
  local descriptions=rawdata.descriptions
  local resources=rawdata.resources
  local unicodes=resources.unicodes
  for ligname,ligdata in next,ligatures do
   local one=descriptions[unicodes[ligname]]
   if one then
    for _,pair in next,ligdata do
     local two=unicodes[pair[1]]
     local three=unicodes[pair[2]]
     if two and three then
      local ol=one.ligatures
      if ol then
       if not ol[two] then
        ol[two]=three
       end
      else
       one.ligatures={ [two]=three }
      end
     end
    end
   end
  end
 end
end
local function enhance_add_ligatures(rawdata)
 addthem(rawdata,afm.helpdata.ligatures)
end
local function enhance_add_extra_kerns(rawdata) 
 local descriptions=rawdata.descriptions
 local resources=rawdata.resources
 local unicodes=resources.unicodes
 local function do_it_left(what)
  if what then
   for unicode,description in next,descriptions do
    local kerns=description.kerns
    if kerns then
     local extrakerns
     for complex,simple in next,what do
      complex=unicodes[complex]
      simple=unicodes[simple]
      if complex and simple then
       local ks=kerns[simple]
       if ks and not kerns[complex] then
        if extrakerns then
         extrakerns[complex]=ks
        else
         extrakerns={ [complex]=ks }
        end
       end
      end
     end
     if extrakerns then
      description.extrakerns=extrakerns
     end
    end
   end
  end
 end
 local function do_it_copy(what)
  if what then
   for complex,simple in next,what do
    complex=unicodes[complex]
    simple=unicodes[simple]
    if complex and simple then
     local complexdescription=descriptions[complex]
     if complexdescription then 
      local simpledescription=descriptions[complex]
      if simpledescription then
       local extrakerns
       local kerns=simpledescription.kerns
       if kerns then
        for unicode,kern in next,kerns do
         if extrakerns then
          extrakerns[unicode]=kern
         else
          extrakerns={ [unicode]=kern }
         end
        end
       end
       local extrakerns=simpledescription.extrakerns
       if extrakerns then
        for unicode,kern in next,extrakerns do
         if extrakerns then
          extrakerns[unicode]=kern
         else
          extrakerns={ [unicode]=kern }
         end
        end
       end
       if extrakerns then
        complexdescription.extrakerns=extrakerns
       end
      end
     end
    end
   end
  end
 end
 do_it_left(afm.helpdata.leftkerned)
 do_it_left(afm.helpdata.bothkerned)
 do_it_copy(afm.helpdata.bothkerned)
 do_it_copy(afm.helpdata.rightkerned)
end
local function adddimensions(data) 
 if data then
  for unicode,description in next,data.descriptions do
   local bb=description.boundingbox
   if bb then
    local ht=bb[4]
    local dp=-bb[2]
    if ht==0 or ht<0 then
    else
     description.height=ht
    end
    if dp==0 or dp<0 then
    else
     description.depth=dp
    end
   end
  end
 end
end
local function copytotfm(data)
 if data and data.descriptions then
  local metadata=data.metadata
  local resources=data.resources
  local properties=derivetable(data.properties)
  local descriptions=derivetable(data.descriptions)
  local goodies=derivetable(data.goodies)
  local characters={}
  local parameters={}
  local unicodes=resources.unicodes
  for unicode,description in next,data.descriptions do 
   characters[unicode]={}
  end
  local filename=constructors.checkedfilename(resources)
  local fontname=metadata.fontname or metadata.fullname
  local fullname=metadata.fullname or metadata.fontname
  local endash=0x2013
  local emdash=0x2014
  local space=0x0020 
  local spacer="space"
  local spaceunits=500
  local monospaced=metadata.monospaced
  local charwidth=metadata.charwidth
  local italicangle=metadata.italicangle
  local charxheight=metadata.xheight and metadata.xheight>0 and metadata.xheight
  properties.monospaced=monospaced
  parameters.italicangle=italicangle
  parameters.charwidth=charwidth
  parameters.charxheight=charxheight
  local d_endash=descriptions[endash]
  local d_emdash=descriptions[emdash]
  local d_space=descriptions[space]
  if not d_space or d_space==0 then
   d_space=d_endash
  end
  if d_space then
   spaceunits,spacer=d_space.width or 0,"space"
  end
  if properties.monospaced then
   if spaceunits==0 and d_emdash then
    spaceunits,spacer=d_emdash.width or 0,"emdash"
   end
  else
   if spaceunits==0 and d_endash then
    spaceunits,spacer=d_emdash.width or 0,"endash"
   end
  end
  if spaceunits==0 and charwidth then
   spaceunits,spacer=charwidth or 0,"charwidth"
  end
  if spaceunits==0 then
   spaceunits=tonumber(spaceunits) or 500
  end
  if spaceunits==0 then
   spaceunits=500
  end
  parameters.slant=0
  parameters.space=spaceunits
  parameters.space_stretch=500
  parameters.space_shrink=333
  parameters.x_height=400
  parameters.quad=1000
  if italicangle and italicangle~=0 then
   parameters.italicangle=italicangle
   parameters.italicfactor=math.cos(math.rad(90+italicangle))
   parameters.slant=- math.tan(italicangle*math.pi/180)
  end
  if monospaced then
   parameters.space_stretch=0
   parameters.space_shrink=0
  elseif afm.syncspace then
   parameters.space_stretch=spaceunits/2
   parameters.space_shrink=spaceunits/3
  end
  parameters.extra_space=parameters.space_shrink
  if charxheight then
   parameters.x_height=charxheight
  else
   local x=0x0078 
   if x then
    local x=descriptions[x]
    if x then
     parameters.x_height=x.height
    end
   end
  end
  if metadata.sup then
   local dummy={ 0,0,0 }
   parameters[ 1]=metadata.designsize  or 0
   parameters[ 2]=metadata.checksum    or 0
   parameters[ 3],
   parameters[ 4],
   parameters[ 5]=unpack(metadata.space   or dummy)
   parameters[ 6]=metadata.quad    or 0
   parameters[ 7]=metadata.extraspace or 0
   parameters[ 8],
   parameters[ 9],
   parameters[10]=unpack(metadata.num  or dummy)
   parameters[11],
   parameters[12]=unpack(metadata.denom   or dummy)
   parameters[13],
   parameters[14],
   parameters[15]=unpack(metadata.sup  or dummy)
   parameters[16],
   parameters[17]=unpack(metadata.sub  or dummy)
   parameters[18]=metadata.supdrop or 0
   parameters[19]=metadata.subdrop or 0
   parameters[20],
   parameters[21]=unpack(metadata.delim   or dummy)
   parameters[22]=metadata.axisheight or 0
  end
  parameters.designsize=(metadata.designsize or 10)*65536
  parameters.ascender=abs(metadata.ascender  or 0)
  parameters.descender=abs(metadata.descender or 0)
  parameters.units=1000
  properties.spacer=spacer
  properties.format=fonts.formats[filename] or "type1"
  properties.filename=filename
  properties.fontname=fontname
  properties.fullname=fullname
  properties.psname=fullname
  properties.name=filename or fullname or fontname
  properties.private=properties.private or data.private or privateoffset
if not CONTEXTLMTXMODE or CONTEXTLMTXMODE==0 then
  properties.encodingbytes=2
end
  if next(characters) then
   return {
    characters=characters,
    descriptions=descriptions,
    parameters=parameters,
    resources=resources,
    properties=properties,
    goodies=goodies,
   }
  end
 end
 return nil
end
function afm.setfeatures(tfmdata,features)
 local okay=constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm)
 if okay then
  return constructors.collectprocessors("afm",tfmdata,features,trace_features,report_afm)
 else
  return {} 
 end
end
local function addtables(data)
 local resources=data.resources
 local lookuptags=resources.lookuptags
 local unicodes=resources.unicodes
 if not lookuptags then
  lookuptags={}
  resources.lookuptags=lookuptags
 end
 setmetatableindex(lookuptags,function(t,k)
  local v=type(k)=="number" and ("lookup "..k) or k
  t[k]=v
  return v
 end)
 if not unicodes then
  unicodes={}
  resources.unicodes=unicodes
  setmetatableindex(unicodes,function(t,k)
   setmetatableindex(unicodes,nil)
   for u,d in next,data.descriptions do
    local n=d.name
    if n then
     t[n]=u
    end
   end
   return rawget(t,k)
  end)
 end
 constructors.addcoreunicodes(unicodes) 
end
local function afmtotfm(specification)
 local afmname=specification.filename or specification.name
 if specification.forced=="afm" or specification.format=="afm" then 
  if trace_loading then
   report_afm("forcing afm format for %a",afmname)
  end
 else
  local tfmname=findbinfile(afmname,"ofm") or ""
  if tfmname~="" then
   if trace_loading then
    report_afm("fallback from afm to tfm for %a",afmname)
   end
   return 
  end
 end
 if afmname~="" then
  local features=constructors.checkedfeatures("afm",specification.features.normal)
  specification.features.normal=features
  constructors.hashinstance(specification,true)
  specification=definers.resolve(specification) 
  local cache_id=specification.hash
  local tfmdata=containers.read(constructors.cache,cache_id) 
  if not tfmdata then
   local rawdata=afm.load(afmname)
   if rawdata and next(rawdata) then
    addtables(rawdata)
    adddimensions(rawdata)
    tfmdata=copytotfm(rawdata)
    if tfmdata and next(tfmdata) then
     local shared=tfmdata.shared
     if not shared then
      shared={}
      tfmdata.shared=shared
     end
     shared.rawdata=rawdata
     shared.dynamics={}
     tfmdata.changed={}
     shared.features=features
     shared.processes=afm.setfeatures(tfmdata,features)
    end
   elseif trace_loading then
    report_afm("no (valid) afm file found with name %a",afmname)
   end
   tfmdata=containers.write(constructors.cache,cache_id,tfmdata)
  end
  return tfmdata
 end
end
local function read_from_afm(specification)
 local tfmdata=afmtotfm(specification)
 if tfmdata then
  tfmdata.properties.name=specification.name
  tfmdata.properties.id=specification.id
  tfmdata=constructors.scale(tfmdata,specification)
  local allfeatures=tfmdata.shared.features or specification.features.normal
  constructors.applymanipulators("afm",tfmdata,allfeatures,trace_features,report_afm)
  fonts.loggers.register(tfmdata,'afm',specification)
 end
 return tfmdata
end
registerafmfeature {
 name="mode",
 description="mode",
 initializers={
  base=otf.modeinitializer,
  node=otf.modeinitializer,
 }
}
registerafmfeature {
 name="features",
 description="features",
 default=true,
 initializers={
  node=otf.nodemodeinitializer,
  base=otf.basemodeinitializer,
 },
 processors={
  node=otf.featuresprocessor,
 }
}
fonts.formats.afm="type1"
fonts.formats.pfb="type1"
local function check_afm(specification,fullname)
 local foundname=findbinfile(fullname,'afm') or "" 
 if foundname=="" then
  foundname=fonts.names.getfilename(fullname,"afm") or ""
 end
 if fullname and foundname=="" and afm.autoprefixed then
  local encoding,shortname=match(fullname,"^(.-)%-(.*)$") 
  if encoding and shortname and fonts.encodings.known[encoding] then
   shortname=findbinfile(shortname,'afm') or "" 
   if shortname~="" then
    foundname=shortname
    if trace_defining then
     report_afm("stripping encoding prefix from filename %a",afmname)
    end
   end
  end
 end
 if foundname~="" then
  specification.filename=foundname
  specification.format="afm"
  return read_from_afm(specification)
 end
end
function readers.afm(specification,method)
 local fullname=specification.filename or ""
 local tfmdata=nil
 if fullname=="" then
  local forced=specification.forced or ""
  if forced~="" then
   tfmdata=check_afm(specification,specification.name.."."..forced)
  end
  if not tfmdata then
   local check_tfm=readers.check_tfm
   method=(check_tfm and (method or definers.method or "afm or tfm")) or "afm"
   if method=="tfm" then
    tfmdata=check_tfm(specification,specification.name)
   elseif method=="afm" then
    tfmdata=check_afm(specification,specification.name)
   elseif method=="tfm or afm" then
    tfmdata=check_tfm(specification,specification.name) or check_afm(specification,specification.name)
   else 
    tfmdata=check_afm(specification,specification.name) or check_tfm(specification,specification.name)
   end
  end
 else
  tfmdata=check_afm(specification,fullname)
 end
 return tfmdata
end
function readers.pfb(specification,method) 
 local original=specification.specification
 if trace_defining then
  report_afm("using afm reader for %a",original)
 end
 specification.forced="afm"
 local function swap(name)
  local value=specification[swap]
  if value then
   specification[swap]=gsub("%.pfb",".afm",1)
  end
 end
 swap("filename")
 swap("fullname")
 swap("forcedname")
 swap("specification")
 return readers.afm(specification,method)
end
registerafmenhancer("unify names",enhance_unify_names)
registerafmenhancer("add ligatures",enhance_add_ligatures)
registerafmenhancer("add extra kerns",enhance_add_extra_kerns)
registerafmenhancer("normalize features",enhance_normalize_features)
registerafmenhancer("check extra features",otfenhancers.enhance)
registerafmenhancer("fix names",enhance_fix_names)

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-one”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-afk” 9da14e0fb22129c053acc599d1312544] ---

if not modules then modules={} end modules ['font-afk']={
 version=1.001,
 comment="companion to font-lib.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files",
 dataonly=true,
}
local allocate=utilities.storage.allocate
fonts.handlers.afm.helpdata={
 ligatures=allocate { 
  ['f']={ 
   { 'f','ff' },
   { 'i','fi' },
   { 'l','fl' },
  },
  ['ff']={
   { 'i','ffi' }
  },
  ['fi']={
   { 'i','fii' }
  },
  ['fl']={
   { 'i','fli' }
  },
  ['s']={
   { 't','st' }
  },
  ['i']={
   { 'j','ij' }
  },
 },
 texligatures=allocate {
  ['quoteleft']={
   { 'quoteleft','quotedblleft' }
  },
  ['quoteright']={
   { 'quoteright','quotedblright' }
  },
  ['hyphen']={
   { 'hyphen','endash' }
  },
  ['endash']={
   { 'hyphen','emdash' }
  }
 },
 leftkerned=allocate {
  AEligature="A",aeligature="a",
  OEligature="O",oeligature="o",
  IJligature="I",ijligature="i",
  AE="A",ae="a",
  OE="O",oe="o",
  IJ="I",ij="i",
  Ssharp="S",ssharp="s",
 },
 rightkerned=allocate {
  AEligature="E",aeligature="e",
  OEligature="E",oeligature="e",
  IJligature="J",ijligature="j",
  AE="E",ae="e",
  OE="E",oe="e",
  IJ="J",ij="j",
  Ssharp="S",ssharp="s",
 },
 bothkerned=allocate {
  Acircumflex="A",acircumflex="a",
  Ccircumflex="C",ccircumflex="c",
  Ecircumflex="E",ecircumflex="e",
  Gcircumflex="G",gcircumflex="g",
  Hcircumflex="H",hcircumflex="h",
  Icircumflex="I",icircumflex="i",
  Jcircumflex="J",jcircumflex="j",
  Ocircumflex="O",ocircumflex="o",
  Scircumflex="S",scircumflex="s",
  Ucircumflex="U",ucircumflex="u",
  Wcircumflex="W",wcircumflex="w",
  Ycircumflex="Y",ycircumflex="y",
  Agrave="A",agrave="a",
  Egrave="E",egrave="e",
  Igrave="I",igrave="i",
  Ograve="O",ograve="o",
  Ugrave="U",ugrave="u",
  Ygrave="Y",ygrave="y",
  Atilde="A",atilde="a",
  Itilde="I",itilde="i",
  Otilde="O",otilde="o",
  Utilde="U",utilde="u",
  Ntilde="N",ntilde="n",
  Adiaeresis="A",adiaeresis="a",Adieresis="A",adieresis="a",
  Ediaeresis="E",ediaeresis="e",Edieresis="E",edieresis="e",
  Idiaeresis="I",idiaeresis="i",Idieresis="I",idieresis="i",
  Odiaeresis="O",odiaeresis="o",Odieresis="O",odieresis="o",
  Udiaeresis="U",udiaeresis="u",Udieresis="U",udieresis="u",
  Ydiaeresis="Y",ydiaeresis="y",Ydieresis="Y",ydieresis="y",
  Aacute="A",aacute="a",
  Cacute="C",cacute="c",
  Eacute="E",eacute="e",
  Iacute="I",iacute="i",
  Lacute="L",lacute="l",
  Nacute="N",nacute="n",
  Oacute="O",oacute="o",
  Racute="R",racute="r",
  Sacute="S",sacute="s",
  Uacute="U",uacute="u",
  Yacute="Y",yacute="y",
  Zacute="Z",zacute="z",
  Dstroke="D",dstroke="d",
  Hstroke="H",hstroke="h",
  Tstroke="T",tstroke="t",
  Cdotaccent="C",cdotaccent="c",
  Edotaccent="E",edotaccent="e",
  Gdotaccent="G",gdotaccent="g",
  Idotaccent="I",idotaccent="i",
  Zdotaccent="Z",zdotaccent="z",
  Amacron="A",amacron="a",
  Emacron="E",emacron="e",
  Imacron="I",imacron="i",
  Omacron="O",omacron="o",
  Umacron="U",umacron="u",
  Ccedilla="C",ccedilla="c",
  Kcedilla="K",kcedilla="k",
  Lcedilla="L",lcedilla="l",
  Ncedilla="N",ncedilla="n",
  Rcedilla="R",rcedilla="r",
  Scedilla="S",scedilla="s",
  Tcedilla="T",tcedilla="t",
  Ohungarumlaut="O",ohungarumlaut="o",
  Uhungarumlaut="U",uhungarumlaut="u",
  Aogonek="A",aogonek="a",
  Eogonek="E",eogonek="e",
  Iogonek="I",iogonek="i",
  Uogonek="U",uogonek="u",
  Aring="A",aring="a",
  Uring="U",uring="u",
  Abreve="A",abreve="a",
  Ebreve="E",ebreve="e",
  Gbreve="G",gbreve="g",
  Ibreve="I",ibreve="i",
  Obreve="O",obreve="o",
  Ubreve="U",ubreve="u",
  Ccaron="C",ccaron="c",
  Dcaron="D",dcaron="d",
  Ecaron="E",ecaron="e",
  Lcaron="L",lcaron="l",
  Ncaron="N",ncaron="n",
  Rcaron="R",rcaron="r",
  Scaron="S",scaron="s",
  Tcaron="T",tcaron="t",
  Zcaron="Z",zcaron="z",
  dotlessI="I",dotlessi="i",
  dotlessJ="J",dotlessj="j",
  AEligature="AE",aeligature="ae",AE="AE",ae="ae",
  OEligature="OE",oeligature="oe",OE="OE",oe="oe",
  IJligature="IJ",ijligature="ij",IJ="IJ",ij="ij",
  Lstroke="L",lstroke="l",Lslash="L",lslash="l",
  Ostroke="O",ostroke="o",Oslash="O",oslash="o",
  Ssharp="SS",ssharp="ss",
  Aumlaut="A",aumlaut="a",
  Eumlaut="E",eumlaut="e",
  Iumlaut="I",iumlaut="i",
  Oumlaut="O",oumlaut="o",
  Uumlaut="U",uumlaut="u",
 }
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-afk”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-tfm” f0eb5e2a8068b17ad401bb7efdba1630] ---

if not modules then modules={} end modules ['luatex-fonts-tfm']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type=next,type
local match,format=string.match,string.format
local concat,sortedhash=table.concat,table.sortedhash
local idiv=number.idiv
local trace_defining=false  trackers.register("fonts.defining",function(v) trace_defining=v end)
local trace_features=false  trackers.register("tfm.features",function(v) trace_features=v end)
local report_defining=logs.reporter("fonts","defining")
local report_tfm=logs.reporter("fonts","tfm loading")
local findbinfile=resolvers.findbinfile
local setmetatableindex=table.setmetatableindex
local fonts=fonts
local handlers=fonts.handlers
local helpers=fonts.helpers
local readers=fonts.readers
local constructors=fonts.constructors
local encodings=fonts.encodings
local tfm=constructors.handlers.tfm
tfm.version=1.000
tfm.maxnestingdepth=5
tfm.maxnestingsize=65536*1024
local otf=fonts.handlers.otf
local otfenhancers=otf.enhancers
local tfmfeatures=constructors.features.tfm
local registertfmfeature=tfmfeatures.register
local tfmenhancers=constructors.enhancers.tfm
local registertfmenhancer=tfmenhancers.register
local charcommand=helpers.commands.char
constructors.resolvevirtualtoo=false 
fonts.formats.tfm="type1" 
fonts.formats.ofm="type1" 
function tfm.setfeatures(tfmdata,features)
 local okay=constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm)
 if okay then
  return constructors.collectprocessors("tfm",tfmdata,features,trace_features,report_tfm)
 else
  return {} 
 end
end
local depth={} 
local loadtfm=font.read_tfm
local loadvf=font.read_vf
local function read_from_tfm(specification)
 local filename=specification.filename
 local size=specification.size
 depth[filename]=(depth[filename] or 0)+1
 if trace_defining then
  report_defining("loading tfm file %a at size %s",filename,size)
 end
 local tfmdata=loadtfm(filename,size)
 if tfmdata then
  local features=specification.features and specification.features.normal or {}
  local features=constructors.checkedfeatures("tfm",features)
  specification.features.normal=features
  local newtfmdata=(depth[filename]==1) and tfm.reencode(tfmdata,specification)
  if newtfmdata then
    tfmdata=newtfmdata
  end
  local resources=tfmdata.resources  or {}
  local properties=tfmdata.properties or {}
  local parameters=tfmdata.parameters or {}
  local shared=tfmdata.shared  or {}
  shared.features=features
  shared.resources=resources
  properties.name=tfmdata.name     
  properties.fontname=tfmdata.fontname    
  properties.psname=tfmdata.psname   
  properties.fullname=tfmdata.fullname    
  properties.filename=specification.filename 
  properties.format=tfmdata.format or fonts.formats.tfm 
  properties.usedbitmap=tfmdata.usedbitmap
  tfmdata.properties=properties
  tfmdata.resources=resources
  tfmdata.parameters=parameters
  tfmdata.shared=shared
  shared.rawdata={ resources=resources }
  shared.features=features
  if newtfmdata then
   if not resources.marks then
    resources.marks={}
   end
   if not resources.sequences then
    resources.sequences={}
   end
   if not resources.features then
    resources.features={
     gsub={},
     gpos={},
    }
   end
   if not tfmdata.changed then
    tfmdata.changed={}
   end
   if not tfmdata.descriptions then
    tfmdata.descriptions=tfmdata.characters
   end
   otf.readers.addunicodetable(tfmdata)
   tfmenhancers.apply(tfmdata,filename)
   constructors.applymanipulators("tfm",tfmdata,features,trace_features,report_tfm)
   otf.readers.unifymissing(tfmdata)
   fonts.mappings.addtounicode(tfmdata,filename)
   tfmdata.tounicode=1
   local tounicode=fonts.mappings.tounicode
   for unicode,v in next,tfmdata.characters do
    local u=v.unicode
    if u then
     v.tounicode=tounicode(u)
    end
   end
   if tfmdata.usedbitmap then
    tfm.addtounicode(tfmdata)
   end
  end
  shared.processes=next(features) and tfm.setfeatures(tfmdata,features) or nil
  if size<0 then
   size=idiv(65536*-size,100)
  end
  parameters.factor=1  
  parameters.units=1000  
  parameters.size=size
  parameters.slant=parameters.slant    or parameters[1] or 0
  parameters.space=parameters.space    or parameters[2] or 0
  parameters.space_stretch=parameters.space_stretch  or parameters[3] or 0
  parameters.space_shrink=parameters.space_shrink   or parameters[4] or 0
  parameters.x_height=parameters.x_height    or parameters[5] or 0
  parameters.quad=parameters.quad     or parameters[6] or 0
  parameters.extra_space=parameters.extra_space or parameters[7] or 0
  constructors.enhanceparameters(parameters)
  properties.private=properties.private or tfmdata.private or privateoffset
  if newtfmdata then
  elseif constructors.resolvevirtualtoo then
   fonts.loggers.register(tfmdata,file.suffix(filename),specification) 
   local vfname=findbinfile(specification.name,'ovf')
   if vfname and vfname~="" then
    local vfdata=loadvf(vfname,size)
    if vfdata then
     local chars=tfmdata.characters
     for k,v in next,vfdata.characters do
      chars[k].commands=v.commands
     end
     properties.virtualized=true
     tfmdata.fonts=vfdata.fonts
     tfmdata.type="virtual" 
     local fontlist=vfdata.fonts
     local name=file.nameonly(filename)
     for i=1,#fontlist do
      local n=fontlist[i].name
      local s=fontlist[i].size
      local d=depth[filename]
      s=constructors.scaled(s,vfdata.designsize)
      if d>tfm.maxnestingdepth then
       report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth)
       fontlist[i]={ id=0 }
      elseif (d>1) and (s>tfm.maxnestingsize) then
       report_defining("virtual font %a exceeds size %s",n,s)
       fontlist[i]={ id=0 }
      else
       local t,id=constructors.readanddefine(n,s)
       fontlist[i]={ id=id }
      end
     end
    end
   end
  end
  properties.haskerns=true
  properties.hasligatures=true
  properties.hasitalics=true
  resources.unicodes={}
  resources.lookuptags={}
  depth[filename]=depth[filename]-1
  return tfmdata
 else
  depth[filename]=depth[filename]-1
 end
end
local function check_tfm(specification,fullname) 
 local foundname=findbinfile(fullname,'tfm') or ""
 if foundname=="" then
  foundname=findbinfile(fullname,'ofm') or "" 
 end
 if foundname=="" then
  foundname=fonts.names.getfilename(fullname,"tfm") or ""
 end
 if foundname~="" then
  specification.filename=foundname
  specification.format="ofm"
  return read_from_tfm(specification)
 elseif trace_defining then
  report_defining("loading tfm with name %a fails",specification.name)
 end
end
readers.check_tfm=check_tfm
function readers.tfm(specification)
 local fullname=specification.filename or ""
 if fullname=="" then
  local forced=specification.forced or ""
  if forced~="" then
   fullname=specification.name.."."..forced
  else
   fullname=specification.name
  end
 end
 return check_tfm(specification,fullname)
end
readers.ofm=readers.tfm
do
 local outfiles={}
 local tfmcache=table.setmetatableindex(function(t,tfmdata)
  local id=font.define(tfmdata)
  t[tfmdata]=id
  return id
 end)
 local encdone=table.setmetatableindex("table")
 function tfm.reencode(tfmdata,specification)
  local features=specification.features
  if not features then
   return
  end
  local features=features.normal
  if not features then
   return
  end
  local tfmfile=file.basename(tfmdata.name)
  local encfile=features.reencode 
  local pfbfile=features.pfbfile  
  local bitmap=features.bitmap   
  if not encfile then
   return
  end
  local pfbfile=outfiles[tfmfile]
  if pfbfile==nil then
   if bitmap then
    pfbfile=false
   elseif type(pfbfile)~="string" then
    pfbfile=tfmfile
   end
   if type(pfbfile)=="string" then
    pfbfile=file.addsuffix(pfbfile,"pfb")
    report_tfm("using type1 shapes from %a for %a",pfbfile,tfmfile)
   else
    report_tfm("using bitmap shapes for %a",tfmfile)
    pfbfile=false 
   end
   outfiles[tfmfile]=pfbfile
  end
  local encoding=false
  local vector=false
  if type(pfbfile)=="string" then
   local pfb=constructors.handlers.pfb
   if pfb and pfb.loadvector then
    local v,e=pfb.loadvector(pfbfile)
    if v then
     vector=v
    end
    if e then
     encoding=e
    end
   end
  end
  if type(encfile)=="string" and encfile~="auto" then
   encoding=fonts.encodings.load(file.addsuffix(encfile,"enc"))
   if encoding then
    encoding=encoding.vector
   end
  end
  if not encoding then
   report_tfm("bad encoding for %a, quitting",tfmfile)
   return
  end
  local unicoding=fonts.encodings.agl and fonts.encodings.agl.unicodes
  local virtualid=tfmcache[tfmdata]
  local tfmdata=table.copy(tfmdata) 
  local characters={}
  local originals=tfmdata.characters
  local indices={}
  local parentfont={ "font",1 }
  local private=tfmdata.privateoffset or constructors.privateoffset
  local reported=encdone[tfmfile][encfile]
  local backmap=vector and table.swapped(vector)
  local done={} 
  for index,name in sortedhash(encoding) do 
   local unicode=unicoding[name]
   local original=originals[index]
   if original then
    if unicode then
     original.unicode=unicode
    else
     unicode=private
     private=private+1
     if not reported then
      report_tfm("glyph %a in font %a with encoding %a gets unicode %U",name,tfmfile,encfile,unicode)
     end
    end
    characters[unicode]=original
    indices[index]=unicode
    original.name=name 
    if backmap then
     original.index=backmap[name]
    else 
     original.commands={ parentfont,charcommand[index] } 
     original.oindex=index
    end
    done[name]=true
   elseif not done[name] then
    report_tfm("bad index %a in font %a with name %a",index,tfmfile,name)
   end
  end
  encdone[tfmfile][encfile]=true
  for k,v in next,characters do
   local kerns=v.kerns
   if kerns then
    local t={}
    for k,v in next,kerns do
     local i=indices[k]
     if i then
      t[i]=v
     end
    end
    v.kerns=next(t) and t or nil
   end
   local ligatures=v.ligatures
   if ligatures then
    local t={}
    for k,v in next,ligatures do
     local i=indices[k]
     if i then
      t[i]=v
      v.char=indices[v.char]
     end
    end
    v.ligatures=next(t) and t or nil
   end
  end
  tfmdata.fonts={ { id=virtualid } }
  tfmdata.characters=characters
  tfmdata.fullname=tfmdata.fullname or tfmdata.name
  tfmdata.psname=file.nameonly(pfbfile or tfmdata.name)
  tfmdata.filename=pfbfile
  tfmdata.encodingbytes=2
  tfmdata.format="type1"
  tfmdata.tounicode=1
  tfmdata.embedding="subset"
  tfmdata.usedbitmap=bitmap and virtualid
  tfmdata.private=private
  return tfmdata
 end
end
do
 local template=[[
/CIDInit /ProcSet findresource begin
  12 dict begin
  begincmap
    /CIDSystemInfo << /Registry (TeX) /Ordering (bitmap-%s) /Supplement 0 >> def
    /CMapName /TeX-bitmap-%s def
    /CMapType 2 def
    1 begincodespacerange
      <00> <FF>
    endcodespacerange
    %s beginbfchar
%s
    endbfchar
  endcmap
CMapName currentdict /CMap defineresource pop end
end
end
]]
 local flushstreamobject=lpdf and lpdf.flushstreamobject 
 local setfontattributes=lpdf and lpdf.setfontattributes 
 if not flushstreamobject then
  flushstreamobject=function(data)
   return pdf.obj { immediate=true,type="stream",string=data } 
  end
 end
 if not setfontattributes then
  setfontattributes=function(id,data)
   return pdf.setfontattributes(id,data) 
  end
 end
 function tfm.addtounicode(tfmdata)
  local id=tfmdata.usedbitmap
  local map={}
  local char={} 
  for k,v in next,tfmdata.characters do
   local index=v.oindex
   local tounicode=v.tounicode
   if index and tounicode then
    map[index]=tounicode
   end
  end
  for k,v in sortedhash(map) do
   char[#char+1]=format("<%02X> <%s>",k,v)
  end
  char=concat(char,"\n")
  local stream=format(template,id,id,#char,char)
  local reference=flushstreamobject(stream,nil,true)
  setfontattributes(id,format("/ToUnicode %i 0 R",reference))
 end
end
do
 local everywhere={ ["*"]={ ["*"]=true } } 
 local noflags={ false,false,false,false }
 local function enhance_normalize_features(data)
  local ligatures=setmetatableindex("table")
  local kerns=setmetatableindex("table")
  local characters=data.characters
  for u,c in next,characters do
   local l=c.ligatures
   local k=c.kerns
   if l then
    ligatures[u]=l
    for u,v in next,l do
     l[u]={ ligature=v.char }
    end
    c.ligatures=nil
   end
   if k then
    kerns[u]=k
    for u,v in next,k do
     k[u]=v 
    end
    c.kerns=nil
   end
  end
  for u,l in next,ligatures do
   for k,v in next,l do
    local vl=v.ligature
    local dl=ligatures[vl]
    if dl then
     for kk,vv in next,dl do
      v[kk]=vv 
     end
    end
   end
  end
  local features={
   gpos={},
   gsub={},
  }
  local sequences={
  }
  if next(ligatures) then
   features.gsub.liga=everywhere
   data.properties.hasligatures=true
   sequences[#sequences+1]={
    features={
     liga=everywhere,
    },
    flags=noflags,
    name="s_s_0",
    nofsteps=1,
    order={ "liga" },
    type="gsub_ligature",
    steps={
     {
      coverage=ligatures,
     },
    },
   }
  end
  if next(kerns) then
   features.gpos.kern=everywhere
   data.properties.haskerns=true
   sequences[#sequences+1]={
    features={
     kern=everywhere,
    },
    flags=noflags,
    name="p_s_0",
    nofsteps=1,
    order={ "kern" },
    type="gpos_pair",
    steps={
     {
      format="kern",
      coverage=kerns,
     },
    },
   }
  end
  data.resources.features=features
  data.resources.sequences=sequences
  data.shared.resources=data.shared.resources or resources
 end
 registertfmenhancer("normalize features",enhance_normalize_features)
 registertfmenhancer("check extra features",otfenhancers.enhance)
end
registertfmfeature {
 name="mode",
 description="mode",
 initializers={
  base=otf.modeinitializer,
  node=otf.modeinitializer,
 }
}
registertfmfeature {
 name="features",
 description="features",
 default=true,
 initializers={
  base=otf.basemodeinitializer,
  node=otf.nodemodeinitializer,
 },
 processors={
  node=otf.featuresprocessor,
 }
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-tfm”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-lua” 1fbfdf7b689b2bdfd0e3bb9bf74ce136] ---

if not modules then modules={} end modules ['font-lua']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local trace_defining=false  trackers.register("fonts.defining",function(v) trace_defining=v end)
local report_lua=logs.reporter("fonts","lua loading")
local fonts=fonts
local readers=fonts.readers
fonts.formats.lua="lua"
local function check_lua(specification,fullname)
 local fullname=resolvers.findfile(fullname) or ""
 if fullname~="" then
  local loader=loadfile(fullname)
  loader=loader and loader()
  return loader and loader(specification)
 end
end
readers.check_lua=check_lua
function readers.lua(specification)
 local original=specification.specification
 if trace_defining then
  report_lua("using lua reader for %a",original)
 end
 local fullname=specification.filename or ""
 if fullname=="" then
  local forced=specification.forced or ""
  if forced~="" then
   fullname=specification.name.."."..forced
  else
   fullname=specification.name
  end
 end
 return check_lua(specification,fullname)
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-lua”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-def” b9d908c2338b7dc443ce9d1e9fcb7139] ---

if not modules then modules={} end modules ['font-def']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local lower,gsub=string.lower,string.gsub
local tostring,next=tostring,next
local lpegmatch=lpeg.match
local suffixonly,removesuffix,basename=file.suffix,file.removesuffix,file.basename
local formatters=string.formatters
local sortedhash,sortedkeys=table.sortedhash,table.sortedkeys
local allocate=utilities.storage.allocate
local trace_defining=false  trackers  .register("fonts.defining",function(v) trace_defining=v end)
local directive_embedall=false  directives.register("fonts.embedall",function(v) directive_embedall=v end)
trackers.register("fonts.loading","fonts.defining","otf.loading","afm.loading","tfm.loading")
local report_defining=logs.reporter("fonts","defining")
local fonts=fonts
local fontdata=fonts.hashes.identifiers
local readers=fonts.readers
local definers=fonts.definers
local specifiers=fonts.specifiers
local constructors=fonts.constructors
local fontgoodies=fonts.goodies
readers.sequence=allocate { 'otf','ttf','afm','tfm','lua' } 
local variants=allocate()
specifiers.variants=variants
definers.methods=definers.methods or {}
local internalized=allocate() 
local loadedfonts=constructors.loadedfonts
local designsizes=constructors.designsizes
local resolvefile=fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
local function makespecification(specification,lookup,name,sub,method,detail,size)
 size=size or 655360
 if not lookup or lookup=="" then
  lookup=definers.defaultlookup
 end
 if trace_defining then
  report_defining("specification %a, lookup %a, name %a, sub %a, method %a, detail %a",
   specification,lookup,name,sub,method,detail)
 end
 local t={
  lookup=lookup,
  specification=specification,
  size=size,
  name=name,
  sub=sub,
  method=method,
  detail=detail,
  resolved="",
  forced="",
  features={},
 }
 return t
end
definers.makespecification=makespecification
if context then
 local splitter,splitspecifiers=nil,"" 
 local P,C,S,Cc,Cs=lpeg.P,lpeg.C,lpeg.S,lpeg.Cc,lpeg.Cs
 local left=P("(")
 local right=P(")")
 local colon=P(":")
 local space=P(" ")
 local lbrace=P("{")
 local rbrace=P("}")
 definers.defaultlookup="file"
 local prefixpattern=P(false)
 local function addspecifier(symbol)
  splitspecifiers=splitspecifiers..symbol
  local method=S(splitspecifiers)
  local lookup=C(prefixpattern)*colon
  local sub=left*C(P(1-left-right-method)^1)*right
  local specification=C(method)*C(P(1)^1)
  local name=Cs((lbrace/"")*(1-rbrace)^1*(rbrace/"")+(1-sub-specification)^1)
  splitter=P((lookup+Cc(""))*name*(sub+Cc(""))*(specification+Cc("")))
 end
 local function addlookup(str)
  prefixpattern=prefixpattern+P(str)
 end
 definers.addlookup=addlookup
 addlookup("file")
 addlookup("name")
 addlookup("spec")
 local function getspecification(str)
  return lpegmatch(splitter,str or "") 
 end
 definers.getspecification=getspecification
 function definers.registersplit(symbol,action,verbosename)
  addspecifier(symbol)
  variants[symbol]=action
  if verbosename then
   variants[verbosename]=action
  end
 end
 function definers.analyze(specification,size)
  local lookup,name,sub,method,detail=getspecification(specification or "")
  return makespecification(specification,lookup,name,sub,method,detail,size)
 end
end
definers.resolvers=definers.resolvers or {}
local resolvers=definers.resolvers
function resolvers.file(specification)
 local name=resolvefile(specification.name) 
 local suffix=lower(suffixonly(name))
 if fonts.formats[suffix] then
  specification.forced=suffix
  specification.forcedname=name
  specification.name=removesuffix(name)
 else
  specification.name=name 
 end
end
function resolvers.name(specification)
 local resolve=fonts.names.resolve
 if resolve then
  local resolved,sub,subindex,instance=resolve(specification.name,specification.sub,specification) 
  if resolved then
   specification.resolved=resolved
   specification.sub=sub
   specification.subindex=subindex
   if instance then
    specification.instance=instance
    local features=specification.features
    if not features then
     features={}
     specification.features=features
    end
    local normal=features.normal
    if not normal then
     normal={}
     features.normal=normal
    end
    normal.instance=instance
   end
   local suffix=lower(suffixonly(resolved))
   if fonts.formats[suffix] then
    specification.forced=suffix
    specification.forcedname=resolved
    specification.name=removesuffix(resolved)
   else
    specification.name=resolved
   end
  end
 else
  resolvers.file(specification)
 end
end
function resolvers.spec(specification)
 local resolvespec=fonts.names.resolvespec
 if resolvespec then
  local resolved,sub,subindex=resolvespec(specification.name,specification.sub,specification) 
  if resolved then
   specification.resolved=resolved
   specification.sub=sub
   specification.subindex=subindex
   specification.forced=lower(suffixonly(resolved))
   specification.forcedname=resolved
   specification.name=removesuffix(resolved)
  end
 else
  resolvers.name(specification)
 end
end
function definers.resolve(specification)
 if not specification.resolved or specification.resolved=="" then 
  local r=resolvers[specification.lookup]
  if r then
   r(specification)
  end
 end
 if specification.forced=="" then
  specification.forced=nil
  specification.forcedname=nil
 end
 specification.hash=lower(specification.name..' @ '..constructors.hashfeatures(specification))
 if specification.sub and specification.sub~="" then
  specification.hash=specification.sub..' @ '..specification.hash
 end
 return specification
end
function definers.applypostprocessors(tfmdata)
 local postprocessors=tfmdata.postprocessors
 if postprocessors then
  local properties=tfmdata.properties
  for i=1,#postprocessors do
   local extrahash=postprocessors[i](tfmdata) 
   if type(extrahash)=="string" and extrahash~="" then
    extrahash=gsub(lower(extrahash),"[^a-z]","-")
    properties.fullname=formatters["%s-%s"](properties.fullname,extrahash)
   end
  end
 end
 return tfmdata
end
local function checkembedding(tfmdata)
 local properties=tfmdata.properties
 local embedding
 if directive_embedall then
  embedding="full"
 elseif properties and properties.filename and constructors.dontembed[properties.filename] then
  embedding="no"
 else
  embedding="subset"
 end
 if properties then
  properties.embedding=embedding
 else
  tfmdata.properties={ embedding=embedding }
 end
 tfmdata.embedding=embedding
end
local function checkfeatures(tfmdata)
 local resources=tfmdata.resources
 local shared=tfmdata.shared
 if resources and shared then
  local features=resources.features
  local usedfeatures=shared.features
  if features and usedfeatures then
   local usedlanguage=usedfeatures.language or "dflt"
   local usedscript=usedfeatures.script or "dflt"
   local function check(what)
    if what then
     local foundlanguages={}
     for feature,scripts in next,what do
      if usedscript=="auto" or scripts["*"] then
      elseif not scripts[usedscript] then
      else
       for script,languages in next,scripts do
        if languages["*"] then
        elseif context and not languages[usedlanguage] then
         report_defining("font %!font:name!, feature %a, script %a, no language %a",
          tfmdata,feature,script,usedlanguage)
        end
       end
      end
      for script,languages in next,scripts do
       for language in next,languages do
        foundlanguages[language]=true
       end
      end
     end
     if false then
      foundlanguages["*"]=nil
      foundlanguages=sortedkeys(foundlanguages)
      for feature,scripts in sortedhash(what) do
       for script,languages in next,scripts do
        if not languages["*"] then
         for i=1,#foundlanguages do
          local language=foundlanguages[i]
          if context and not languages[language] then
           report_defining("font %!font:name!, feature %a, script %a, no language %a",
            tfmdata,feature,script,language)
          end
         end
        end
       end
      end
     end
    end
   end
   check(features.gsub)
   check(features.gpos)
  end
 end
end
function definers.loadfont(specification)
 local hash=constructors.hashinstance(specification)
 local tfmdata=loadedfonts[hash] 
 if not tfmdata then
  local forced=specification.forced or ""
  if forced~="" then
   local reader=readers[lower(forced)] 
   tfmdata=reader and reader(specification)
   if not tfmdata then
    report_defining("forced type %a of %a not found",forced,specification.name)
   end
  else
   local sequence=readers.sequence 
   for s=1,#sequence do
    local reader=sequence[s]
    if readers[reader] then 
     if trace_defining then
      report_defining("trying (reader sequence driven) type %a for %a with file %a",reader,specification.name,specification.filename)
     end
     tfmdata=readers[reader](specification)
     if tfmdata then
      break
     else
      specification.filename=nil
     end
    end
   end
  end
  if tfmdata then
   tfmdata=definers.applypostprocessors(tfmdata)
   checkembedding(tfmdata) 
   loadedfonts[hash]=tfmdata
   designsizes[specification.hash]=tfmdata.parameters.designsize
   checkfeatures(tfmdata)
  end
 end
 if not tfmdata then
  report_defining("font with asked name %a is not found using lookup %a",specification.name,specification.lookup)
 end
 return tfmdata
end
function constructors.readanddefine(name,size) 
 local specification=definers.analyze(name,size)
 local method=specification.method
 if method and variants[method] then
  specification=variants[method](specification)
 end
 specification=definers.resolve(specification)
 local hash=constructors.hashinstance(specification)
 local id=definers.registered(hash)
 if not id then
  local tfmdata=definers.loadfont(specification)
  if tfmdata then
   tfmdata.properties.hash=hash
   id=font.define(tfmdata)
   definers.register(tfmdata,id)
  else
   id=0  
  end
 end
 return fontdata[id],id
end
function definers.registered(hash)
 local id=internalized[hash]
 return id,id and fontdata[id]
end
function definers.register(tfmdata,id)
 if tfmdata and id then
  local hash=tfmdata.properties.hash
  if not hash then
   report_defining("registering font, id %a, name %a, invalid hash",id,tfmdata.properties.filename or "?")
  elseif not internalized[hash] then
   internalized[hash]=id
   if trace_defining then
    report_defining("registering font, id %s, hash %a",id,hash)
   end
   fontdata[id]=tfmdata
  end
 end
end
function definers.read(specification,size,id) 
 statistics.starttiming(fonts)
 if type(specification)=="string" then
  specification=definers.analyze(specification,size)
 end
 local method=specification.method
 if method and variants[method] then
  specification=variants[method](specification)
 end
 specification=definers.resolve(specification)
 local hash=constructors.hashinstance(specification)
 local tfmdata=definers.registered(hash) 
 if tfmdata then
  if trace_defining then
   report_defining("already hashed: %s",hash)
  end
 else
  tfmdata=definers.loadfont(specification)
  if tfmdata then
   tfmdata.original=specification.specification
   if trace_defining then
    report_defining("loaded and hashed: %s",hash)
   end
   tfmdata.properties.hash=hash
   if id then
    definers.register(tfmdata,id)
   end
  else
   if trace_defining then
    report_defining("not loaded and hashed: %s",hash)
   end
  end
 end
 if not tfmdata then 
  report_defining("unknown font %a, loading aborted",specification.name)
 elseif trace_defining and type(tfmdata)=="table" then
  local properties=tfmdata.properties or {}
  local parameters=tfmdata.parameters or {}
  report_defining("using %a font with id %a, name %a, size %a, bytes %a, encoding %a, fullname %a, filename %a",
   properties.format or "unknown",id or "-",properties.name,parameters.size,properties.encodingbytes,
   properties.encodingname,properties.fullname,basename(properties.filename))
 end
 statistics.stoptiming(fonts)
 return tfmdata
end
function font.getfont(id)
 return fontdata[id] 
end
if not context then
 callbacks.register('define_font',definers.read,"definition of fonts (tfmdata preparation)")
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-def”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-shp” a40862fe382d26c1f3753431254bcfdd] ---

if not modules then modules={} end modules ['font-shp']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local tonumber,next=tonumber,next
local concat=table.concat
local formatters,lower=string.formatters,string.lower
local otf=fonts.handlers.otf
local afm=fonts.handlers.afm
local pfb=fonts.handlers.pfb
local hashes=fonts.hashes
local identifiers=hashes.identifiers
local version=otf.version or 0.011
local shapescache=containers.define("fonts","shapes",version,true)
local streamscache=containers.define("fonts","streams",version,true)
local compact_streams=false
directives.register("fonts.streams.compact",function(v) compact_streams=v end)
local function packoutlines(data,makesequence)
 local subfonts=data.subfonts
 if subfonts then
  for i=1,#subfonts do
   packoutlines(subfonts[i],makesequence)
  end
  return
 end
 local common=data.segments
 if common then
  return
 end
 local glyphs=data.glyphs
 if not glyphs then
  return
 end
 if makesequence then
  for index=0,#glyphs do
   local glyph=glyphs[index]
   if glyph then
    local segments=glyph.segments
    if segments then
     local sequence={}
     local nofsequence=0
     for i=1,#segments do
      local segment=segments[i]
      local nofsegment=#segment
      nofsequence=nofsequence+1
      sequence[nofsequence]=segment[nofsegment]
      for i=1,nofsegment-1 do
       nofsequence=nofsequence+1
       sequence[nofsequence]=segment[i]
      end
     end
     glyph.sequence=sequence
     glyph.segments=nil
    end
   end
  end
 else
  local hash={}
  local common={}
  local reverse={}
  local last=0
  for index=0,#glyphs do
   local glyph=glyphs[index]
   if glyph then
    local segments=glyph.segments
    if segments then
     for i=1,#segments do
      local h=concat(segments[i]," ")
      hash[h]=(hash[h] or 0)+1
     end
    end
   end
  end
  for index=0,#glyphs do
   local glyph=glyphs[index]
   if glyph then
    local segments=glyph.segments
    if segments then
     for i=1,#segments do
      local segment=segments[i]
      local h=concat(segment," ")
      if hash[h]>1 then 
       local idx=reverse[h]
       if not idx then
        last=last+1
        reverse[h]=last
        common[last]=segment
        idx=last
       end
       segments[i]=idx
      end
     end
    end
   end
  end
  if last>0 then
   data.segments=common
  end
 end
end
local function unpackoutlines(data)
 local subfonts=data.subfonts
 if subfonts then
  for i=1,#subfonts do
   unpackoutlines(subfonts[i])
  end
  return
 end
 local common=data.segments
 if not common then
  return
 end
 local glyphs=data.glyphs
 if not glyphs then
  return
 end
 for index=0,#glyphs do
  local glyph=glyphs[index]
  if glyph then
   local segments=glyph.segments
   if segments then
    for i=1,#segments do
     local c=common[segments[i]]
     if c then
      segments[i]=c
     end
    end
   end
  end
 end
 data.segments=nil
end
local readers=otf.readers
local cleanname=otf.readers.helpers.cleanname
local function makehash(filename,sub,instance)
 local name=cleanname(file.basename(filename))
 if instance then
  return formatters["%s-%s-%s"](name,sub or 0,cleanname(instance))
 else
  return formatters["%s-%s"]   (name,sub or 0)
 end
end
local function loadoutlines(cache,filename,sub,instance)
 local base=file.basename(filename)
 local name=file.removesuffix(base)
 local kind=file.suffix(filename)
 local attr=lfs.attributes(filename)
 local size=attr and attr.size or 0
 local time=attr and attr.modification or 0
 local sub=tonumber(sub)
 if size>0 and (kind=="otf" or kind=="ttf" or kind=="tcc") then
  local hash=makehash(filename,sub,instance)
  data=containers.read(cache,hash)
  if not data or data.time~=time or data.size~=size then
   data=otf.readers.loadshapes(filename,sub,instance)
   if data then
    data.size=size
    data.format=data.format or (kind=="otf" and "opentype") or "truetype"
    data.time=time
    packoutlines(data)
    containers.write(cache,hash,data)
    data=containers.read(cache,hash) 
   end
  end
  unpackoutlines(data)
 elseif size>0 and (kind=="pfb") then
  local hash=containers.cleanname(base) 
  data=containers.read(cache,hash)
  if not data or data.time~=time or data.size~=size then
   data=afm.readers.loadshapes(filename)
   if data then
    data.size=size
    data.format="type1"
    data.time=time
    packoutlines(data)
    containers.write(cache,hash,data)
    data=containers.read(cache,hash) 
   end
  end
  unpackoutlines(data)
 else
  data={
   filename=filename,
   size=0,
   time=time,
   format="unknown",
   units=1000,
   glyphs={}
  }
 end
 return data
end
local function cachethem(cache,hash,data)
 containers.write(cache,hash,data,compact_streams) 
 return containers.read(cache,hash) 
end
local function loadstreams(cache,filename,sub,instance)
 local base=file.basename(filename)
 local name=file.removesuffix(base)
 local kind=lower(file.suffix(filename))
 local attr=lfs.attributes(filename)
 local size=attr and attr.size or 0
 local time=attr and attr.modification or 0
 local sub=tonumber(sub)
 if size>0 and (kind=="otf" or kind=="ttf" or kind=="ttc") then
  local hash=makehash(filename,sub,instance)
  data=containers.read(cache,hash)
  if not data or data.time~=time or data.size~=size then
   data=otf.readers.loadshapes(filename,sub,instance,true)
   if data then
    local glyphs=data.glyphs
    local streams={}
    if glyphs then
     for i=0,#glyphs do
      local glyph=glyphs[i]
      if glyph then
       streams[i]=glyph.stream or ""
      else
       streams[i]=""
      end
     end
    end
    data.streams=streams
    data.glyphs=nil
    data.size=size
    data.format=data.format or (kind=="otf" and "opentype") or "truetype"
    data.time=time
    data=cachethem(cache,hash,data)
   end
  end
 elseif size>0 and (kind=="pfb") then
  local hash=makehash(filename,sub,instance)
  data=containers.read(cache,hash)
  if not data or data.time~=time or data.size~=size then
   local names,encoding,streams,metadata=pfb.loadvector(filename,false,true)
   if streams then
    local fontbbox=metadata.fontbbox or { 0,0,0,0 }
    for i=0,#streams do
     streams[i]=streams[i].stream or "\14"
    end
    data={
     filename=filename,
     size=size,
     time=time,
     format="type1",
     streams=streams,
     fontheader={
      fontversion=metadata.version,
      units=1000,
      xmin=fontbbox[1],
      ymin=fontbbox[2],
      xmax=fontbbox[3],
      ymax=fontbbox[4],
     },
     horizontalheader={
      ascender=0,
      descender=0,
     },
     maximumprofile={
      nofglyphs=#streams+1,
     },
     names={
      copyright=metadata.copyright,
      family=metadata.familyname,
      fullname=metadata.fullname,
      fontname=metadata.fontname,
      subfamily=metadata.subfamilyname,
      trademark=metadata.trademark,
      notice=metadata.notice,
      version=metadata.version,
     },
     cffinfo={
      familyname=metadata.familyname,
      fullname=metadata.fullname,
      italicangle=metadata.italicangle,
      monospaced=metadata.isfixedpitch and true or false,
      underlineposition=metadata.underlineposition,
      underlinethickness=metadata.underlinethickness,
      weight=metadata.weight,
     },
    }
    data=cachethem(cache,hash,data)
   end
  end
 else
  data={
   filename=filename,
   size=0,
   time=time,
   format="unknown",
   streams={}
  }
 end
 return data
end
local loadedshapes={}
local loadedstreams={}
local function loadoutlinedata(fontdata,streams)
 local properties=fontdata.properties
 local filename=properties.filename
 local subindex=fontdata.subindex
 local instance=properties.instance
 local hash=makehash(filename,subindex,instance)
 local loaded=loadedshapes[hash]
 if not loaded then
  loaded=loadoutlines(shapescache,filename,subindex,instance)
  loadedshapes[hash]=loaded
 end
 return loaded
end
hashes.shapes=table.setmetatableindex(function(t,k)
 local f=identifiers[k]
 if f then
  return loadoutlinedata(f)
 end
end)
local function getstreamhash(fontid)
 local fontdata=identifiers[fontid]
 if fontdata then
  local properties=fontdata.properties
  return makehash(properties.filename,properties.subfont,properties.instance),fontdata
 end
end
local function loadstreamdata(fontdata)
 local properties=fontdata.properties
 local shared=fontdata.shared
 local rawdata=shared and shared.rawdata
 local metadata=rawdata and rawdata.metadata
 local filename=properties.filename
 local subindex=metadata and metadata.subfontindex
 local instance=properties.instance
 local hash=makehash(filename,subindex,instance)
 local loaded=loadedstreams[hash]
 if not loaded then
  loaded=loadstreams(streamscache,filename,subindex,instance)
  loadedstreams[hash]=loaded
 end
 return loaded
end
hashes.streams=table.setmetatableindex(function(t,k)
 local f=identifiers[k]
 if f then
  return loadstreamdata(f)
 end
end)
otf.loadoutlinedata=loadoutlinedata 
otf.loadstreamdata=loadstreamdata  
otf.loadshapes=loadshapes
otf.getstreamhash=getstreamhash   
local streams=fonts.hashes.streams
callback.register("glyph_stream_provider",function(id,index,mode)
 if id>0 then
  local streams=streams[id].streams
  if streams then
   return streams[index] or ""
  end
 end
 return ""
end)

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-shp”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-def” f435e0875f203f343157baeff876ec9c] ---

if not modules then modules={} end modules ['luatex-fonts-def']={
 version=1.001,
 comment="companion to luatex-*.tex",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
local fonts=fonts
fonts.constructors.namemode="specification"
function fonts.definers.getspecification(str)
 return "",str,"",":",str
end
local list={} 
local function issome () list.lookup='name'    end 
local function isfile () list.lookup='file'    end
local function isname () list.lookup='name'    end
local function thename(s)   list.name=s      end
local function issub  (v)   list.sub=v      end
local function iscrap (s)   list.crap=string.lower(s) end
local function iskey  (k,v) list[k]=v      end
local function istrue (s)   list[s]=true   end
local function isfalse(s)   list[s]=false     end
local P,S,R,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.Cs
local spaces=P(" ")^0
local namespec=Cs((P("{")/"")*(1-S("}"))^0*(P("}")/"")+(1-S("/:("))^0)
local crapspec=spaces*P("/")*(((1-P(":"))^0)/iscrap)*spaces
local filename_1=P("file:")/isfile*(namespec/thename)
local filename_2=P("[")*P(true)/isfile*(((1-P("]"))^0)/thename)*P("]")
local fontname_1=P("name:")/isname*(namespec/thename)
local fontname_2=P(true)/issome*(namespec/thename)
local sometext=R("az","AZ","09")^1
local somekey=R("az","AZ","09")^1
local somevalue=(P("{")/"")*(1-P("}"))^0*(P("}")/"")+(1-S(";"))^1
local truevalue=P("+")*spaces*(sometext/istrue)
local falsevalue=P("-")*spaces*(sometext/isfalse)
local keyvalue=(C(somekey)*spaces*P("=")*spaces*C(somevalue))/iskey
local somevalue=sometext/istrue
local subvalue=P("(")*(C(P(1-S("()"))^1)/issub)*P(")") 
local option=spaces*(keyvalue+falsevalue+truevalue+somevalue)*spaces
local options=P(":")*spaces*(P(";")^0*option)^0
local pattern=(filename_1+filename_2+fontname_1+fontname_2)*subvalue^0*crapspec^0*options^0
function fonts.definers.analyze(str,size)
 local specification=fonts.definers.makespecification(str,nil,nil,nil,":",nil,size)
 list={}
 lpeg.match(pattern,str)
 list.crap=nil
 if list.name then
  specification.name=list.name
  list.name=nil
 end
 if list.lookup then
  specification.lookup=list.lookup
  list.lookup=nil
 end
 if list.sub then
  specification.sub=list.sub
  list.sub=nil
 end
 specification.features.normal=fonts.handlers.otf.features.normalize(list)
 list=nil
 return specification
end
function fonts.definers.applypostprocessors(tfmdata)
 local postprocessors=tfmdata.postprocessors
 if postprocessors then
  for i=1,#postprocessors do
   local extrahash=postprocessors[i](tfmdata) 
   if type(extrahash)=="string" and extrahash~="" then
    extrahash=string.gsub(lower(extrahash),"[^a-z]","-")
    tfmdata.properties.fullname=format("%s-%s",tfmdata.properties.fullname,extrahash)
   end
  end
 end
 return tfmdata
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-def”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-ext” 32013cbc5d5d336be8b1d1e5879d86c4] ---

if not modules then modules={} end modules ['luatex-fonts-ext']={
 version=1.001,
 comment="companion to luatex-*.tex",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
local byte=string.byte
local fonts=fonts
local handlers=fonts.handlers
local otf=handlers.otf
local afm=handlers.afm
local registerotffeature=otf.features.register
local registerafmfeature=afm.features.register
function fonts.loggers.onetimemessage() end
fonts.protrusions=fonts.protrusions  or {}
fonts.protrusions.setups=fonts.protrusions.setups or {}
local setups=fonts.protrusions.setups
setups['default']={ 
 factor=1,
 left=1,
 right=1,
 [0x002C]={ 0,1 },
 [0x002E]={ 0,1 },
 [0x003A]={ 0,1 },
 [0x003B]={ 0,1 },
 [0x002D]={ 0,1 },
 [0x2013]={ 0,0.50 },
 [0x2014]={ 0,0.33 },
 [0x3001]={ 0,1 },
 [0x3002]={ 0,1 },
 [0x060C]={ 0,1 },
 [0x061B]={ 0,1 },
 [0x06D4]={ 0,1 },
}
local function initializeprotrusion(tfmdata,value)
 if value then
  local setup=setups[value]
  if setup then
   local factor,left,right=setup.factor or 1,setup.left or 1,setup.right or 1
   local emwidth=tfmdata.parameters.quad
   tfmdata.parameters.protrusion={
    auto=true,
   }
   for i,chr in next,tfmdata.characters do
    local v,pl,pr=setup[i],nil,nil
    if v then
     pl,pr=v[1],v[2]
    end
    if pl and pl~=0 then chr.left_protruding=left*pl*factor end
    if pr and pr~=0 then chr.right_protruding=right*pr*factor end
   end
  end
 end
end
local specification={
 name="protrusion",
 description="shift characters into the left and or right margin",
 initializers={
  base=initializeprotrusion,
  node=initializeprotrusion,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
fonts.expansions=fonts.expansions  or {}
fonts.expansions.setups=fonts.expansions.setups or {}
local setups=fonts.expansions.setups
setups['default']={ 
 stretch=2,
 shrink=2,
 step=.5,
 factor=1,
 [byte('A')]=0.5,[byte('B')]=0.7,[byte('C')]=0.7,[byte('D')]=0.5,[byte('E')]=0.7,
 [byte('F')]=0.7,[byte('G')]=0.5,[byte('H')]=0.7,[byte('K')]=0.7,[byte('M')]=0.7,
 [byte('N')]=0.7,[byte('O')]=0.5,[byte('P')]=0.7,[byte('Q')]=0.5,[byte('R')]=0.7,
 [byte('S')]=0.7,[byte('U')]=0.7,[byte('W')]=0.7,[byte('Z')]=0.7,
 [byte('a')]=0.7,[byte('b')]=0.7,[byte('c')]=0.7,[byte('d')]=0.7,[byte('e')]=0.7,
 [byte('g')]=0.7,[byte('h')]=0.7,[byte('k')]=0.7,[byte('m')]=0.7,[byte('n')]=0.7,
 [byte('o')]=0.7,[byte('p')]=0.7,[byte('q')]=0.7,[byte('s')]=0.7,[byte('u')]=0.7,
 [byte('w')]=0.7,[byte('z')]=0.7,
 [byte('2')]=0.7,[byte('3')]=0.7,[byte('6')]=0.7,[byte('8')]=0.7,[byte('9')]=0.7,
}
local function initializeexpansion(tfmdata,value)
 if value then
  local setup=setups[value]
  if setup then
   local factor=setup.factor or 1
   tfmdata.parameters.expansion={
    stretch=10*(setup.stretch or 0),
    shrink=10*(setup.shrink  or 0),
    step=10*(setup.step or 0),
    auto=true,
   }
   for i,chr in next,tfmdata.characters do
    local v=setup[i]
    if v and v~=0 then
     chr.expansion_factor=v*factor
    else 
     chr.expansion_factor=factor
    end
   end
  end
 end
end
local specification={
 name="expansion",
 description="apply hz optimization",
 initializers={
  base=initializeexpansion,
  node=initializeexpansion,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
if not otf.features.normalize then
 otf.features.normalize=function(t)
  if t.rand then
   t.rand="random"
  end
  return t
 end
end
function fonts.helpers.nametoslot(name)
 local t=type(name)
 if t=="string" then
  local tfmdata=fonts.hashes.identifiers[currentfont()]
  local shared=tfmdata and tfmdata.shared
  local fntdata=shared and shared.rawdata
  return fntdata and fntdata.resources.unicodes[name]
 elseif t=="number" then
  return n
 end
end
fonts.encodings=fonts.encodings or {}
local reencodings={}
fonts.encodings.reencodings=reencodings
local function specialreencode(tfmdata,value)
 local encoding=value and reencodings[value]
 if encoding then
  local temp={}
  local char=tfmdata.characters
  for k,v in next,encoding do
   temp[k]=char[v]
  end
  for k,v in next,temp do
   char[k]=temp[k]
  end
  return string.format("reencoded:%s",value)
 end
end
local function initialize(tfmdata,value)
 tfmdata.postprocessors=tfmdata.postprocessors or {}
 table.insert(tfmdata.postprocessors,
  function(tfmdata)
   return specialreencode(tfmdata,value)
  end
 )
end
registerotffeature {
 name="reencode",
 description="reencode characters",
 manipulators={
  base=initialize,
  node=initialize,
 }
}
local function initialize(tfmdata,key,value)
 if value then
  tfmdata.mathparameters=nil
 end
end
registerotffeature {
 name="ignoremathconstants",
 description="ignore math constants table",
 initializers={
  base=initialize,
  node=initialize,
 }
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-ext”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-tex” ceb087ef6fa2f89aed7179f60ddf8f35] ---

if not modules then modules={} end modules ['font-imp-tex']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next=next
local fonts=fonts
local otf=fonts.handlers.otf
local registerotffeature=otf.features.register
local addotffeature=otf.addfeature
local specification={
 type="ligature",
 order={ "tlig" },
 prepend=true,
 data={
  [0x2013]={ 0x002D,0x002D },
  [0x2014]={ 0x002D,0x002D,0x002D },
 },
}
addotffeature("tlig",specification)
registerotffeature {
 name="tlig",
 description="tex ligatures",
}
local specification={
 type="substitution",
 order={ "trep" },
 prepend=true,
 data={
  [0x0027]=0x2019,
 },
}
addotffeature("trep",specification)
registerotffeature {
 name="trep",
 description="tex replacements",
}
local anum_arabic={
 [0x0030]=0x0660,
 [0x0031]=0x0661,
 [0x0032]=0x0662,
 [0x0033]=0x0663,
 [0x0034]=0x0664,
 [0x0035]=0x0665,
 [0x0036]=0x0666,
 [0x0037]=0x0667,
 [0x0038]=0x0668,
 [0x0039]=0x0669,
}
local anum_persian={
 [0x0030]=0x06F0,
 [0x0031]=0x06F1,
 [0x0032]=0x06F2,
 [0x0033]=0x06F3,
 [0x0034]=0x06F4,
 [0x0035]=0x06F5,
 [0x0036]=0x06F6,
 [0x0037]=0x06F7,
 [0x0038]=0x06F8,
 [0x0039]=0x06F9,
}
local function valid(data)
 local features=data.resources.features
 if features then
  for k,v in next,features do
   for k,v in next,v do
    if v.arab then
     return true
    end
   end
  end
 end
end
local specification={
 {
  type="substitution",
  features={ arab={ urd=true,dflt=true } },
  order={ "anum" },
  data=anum_arabic,
  valid=valid,
 },
 {
  type="substitution",
  features={ arab={ urd=true } },
  order={ "anum" },
  data=anum_persian,
  valid=valid,
 },
}
addotffeature("anum",specification)
registerotffeature {
 name="anum",
 description="arabic digits",
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-tex”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-ligatures” 26ffcf089391445f7af59536c8814364] ---

if not modules then modules={} end modules ['font-imp-ligatures']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local lpegmatch=lpeg.match
local utfsplit=utf.split
local settings_to_array=utilities.parsers.settings_to_array
local fonts=fonts
local otf=fonts.handlers.otf
local registerotffeature=otf.features.register
local addotffeature=otf.addfeature
local lookups={}
local protect={}
local revert={}
local zwjchar=0x200C
local zwj={ zwjchar }
addotffeature {
 name="blockligatures",
 type="chainsubstitution",
 nocheck=true,
 prepend=true,
 future=true,
 lookups={
  {
   type="multiple",
   data=lookups,
  },
 },
 data={
  rules=protect,
 }
}
addotffeature {
 name="blockligatures",
 type="chainsubstitution",
 nocheck=true,
 append=true,
 overload=false,
 lookups={
  {
   type="ligature",
   data=lookups,
  },
 },
 data={
  rules=revert,
 }
}
registerotffeature {
 name='blockligatures',
 description='block certain ligatures',
}
local splitter=lpeg.splitat(":")
local function blockligatures(str)
 local t=settings_to_array(str)
 for i=1,#t do
  local ti=t[i]
  local before,current,after=lpegmatch(splitter,ti)
  if current and after then
   if before then
    before=utfsplit(before)
    for i=1,#before do
     before[i]={ before[i] }
    end
   end
   if current then
    current=utfsplit(current)
   end
   if after then
    after=utfsplit(after)
    for i=1,#after do
     after[i]={ after[i] }
    end
   end
  else
   before=nil
   current=utfsplit(ti)
   after=nil
  end
  if #current>1 then
   local one=current[1]
   local two=current[2]
   lookups[one]={ one,zwjchar }
   local one={ one }
   local two={ two }
   local new=#protect+1
   protect[new]={
    before=before,
    current={ one,two },
    after=after,
    lookups={ 1 },
   }
   revert[new]={
    current={ one,zwj },
    after={ two },
    lookups={ 1 },
   }
  end
 end
end
otf.helpers.blockligatures=blockligatures
if context then
 interfaces.implement {
  name="blockligatures",
  arguments="string",
  actions=blockligatures,
 }
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-ligatures”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-italics” defcb415bc1e0a0999b27773902adc18] ---

if not modules then modules={} end modules ['font-imp-italics']={
 version=1.001,
 comment="companion to font-ini.mkiv and hand-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next=next
local fonts=fonts
local handlers=fonts.handlers
local registerotffeature=handlers.otf.features.register
local registerafmfeature=handlers.afm.features.register
local function initialize(tfmdata,key,value)
 for unicode,character in next,tfmdata.characters do
  local olditalic=character.italic
  if olditalic and olditalic~=0 then
   character.width=character.width+olditalic
   character.italic=0
  end
 end
end
local specification={
 name="italicwidths",
 description="add italic to width",
 manipulators={
  base=initialize,
  node=initialize,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
local function initialize(tfmdata,value) 
 if value then
  local parameters=tfmdata.parameters
  local italicangle=parameters.italicangle
  if italicangle and italicangle~=0 then
   local properties=tfmdata.properties
   local factor=tonumber(value) or 1
   properties.hasitalics=true
   properties.autoitalicamount=factor*(parameters.uwidth or 40)/2
  end
 end
end
local specification={
 name="itlc",
 description="italic correction",
 initializers={
  base=initialize,
  node=initialize,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
if context then
 local function initialize(tfmdata,value) 
  tfmdata.properties.textitalics=toboolean(value)
 end
 local specification={
  name="textitalics",
  description="use alternative text italic correction",
  initializers={
   base=initialize,
   node=initialize,
  }
 }
 registerotffeature(specification)
 registerafmfeature(specification)
 local letter=characters.is_letter
 local always=true
 local function collapseitalics(tfmdata,key,value)
  local threshold=value==true and 100 or tonumber(value)
  if threshold and threshold>0 then
   if threshold>100 then
    threshold=100
   end
   for unicode,data in next,tfmdata.characters do
    if always or letter[unicode] or letter[data.unicode] then
     local italic=data.italic
     if italic and italic~=0 then
      local width=data.width
      if width and width~=0 then
       local delta=threshold*italic/100
       data.width=width+delta
       data.italic=italic-delta
      end
     end
    end
   end
  end
 end
 local dimensions_specification={
  name="collapseitalics",
  description="collapse italics",
  manipulators={
   base=collapseitalics,
   node=collapseitalics,
  }
 }
 registerotffeature(dimensions_specification)
 registerafmfeature(dimensions_specification)
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-italics”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-effects” d05997c1826355548ec9aec1346f9f23] ---

if not modules then modules={} end modules ['font-imp-effects']={
 version=1.001,
 comment="companion to font-ini.mkiv",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
local next,type,tonumber=next,type,tonumber
local is_boolean=string.is_boolean
local fonts=fonts
local handlers=fonts.handlers
local registerotffeature=handlers.otf.features.register
local registerafmfeature=handlers.afm.features.register
local settings_to_hash=utilities.parsers.settings_to_hash_colon_too
local helpers=fonts.helpers
local prependcommands=helpers.prependcommands
local charcommand=helpers.commands.char
local leftcommand=helpers.commands.left
local rightcommand=helpers.commands.right
local upcommand=helpers.commands.up
local downcommand=helpers.commands.down
local dummycommand=helpers.commands.dummy
local report_effect=logs.reporter("fonts","effect")
local report_slant=logs.reporter("fonts","slant")
local report_extend=logs.reporter("fonts","extend")
local report_squeeze=logs.reporter("fonts","squeeze")
local trace=false
trackers.register("fonts.effect",function(v) trace=v end)
trackers.register("fonts.slant",function(v) trace=v end)
trackers.register("fonts.extend",function(v) trace=v end)
trackers.register("fonts.squeeze",function(v) trace=v end)
local function initializeslant(tfmdata,value)
 value=tonumber(value)
 if not value then
  value=0
 elseif value>1 then
  value=1
 elseif value<-1 then
  value=-1
 end
 if trace then
  report_slant("applying %0.3f",value)
 end
 tfmdata.parameters.slantfactor=value
end
local specification={
 name="slant",
 description="slant glyphs",
 initializers={
  base=initializeslant,
  node=initializeslant,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializeextend(tfmdata,value)
 value=tonumber(value)
 if not value then
  value=0
 elseif value>10 then
  value=10
 elseif value<-10 then
  value=-10
 end
 if trace then
  report_extend("applying %0.3f",value)
 end
 tfmdata.parameters.extendfactor=value
end
local specification={
 name="extend",
 description="scale glyphs horizontally",
 initializers={
  base=initializeextend,
  node=initializeextend,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializesqueeze(tfmdata,value)
 value=tonumber(value)
 if not value then
  value=0
 elseif value>10 then
  value=10
 elseif value<-10 then
  value=-10
 end
 if trace then
  report_squeeze("applying %0.3f",value)
 end
 tfmdata.parameters.squeezefactor=value
end
local specification={
 name="squeeze",
 description="scale glyphs vertically",
 initializers={
  base=initializesqueeze,
  node=initializesqueeze,
 }
}
registerotffeature(specification)
registerafmfeature(specification)
local effects={
 inner=0,
 normal=0,
 outer=1,
 outline=1,
 both=2,
 hidden=3,
}
local function initializeeffect(tfmdata,value)
 local spec
 if type(value)=="number" then
  spec={ width=value }
 else
  spec=settings_to_hash(value)
 end
 local effect=spec.effect or "both"
 local width=tonumber(spec.width) or 0
 local mode=effects[effect]
 if not mode then
  report_effect("invalid effect %a",effect)
 elseif width==0 and mode==0 then
  report_effect("invalid width %a for effect %a",width,effect)
 else
  local parameters=tfmdata.parameters
  local properties=tfmdata.properties
  parameters.mode=mode
  parameters.width=width*1000
  if is_boolean(spec.auto)==true then
   local squeeze=1-width/20
   local average=(1-squeeze)*width*100
   spec.squeeze=squeeze
   spec.extend=1+width/2
   spec.wdelta=average
   spec.hdelta=average/2
   spec.ddelta=average/2
   spec.vshift=average/2
  end
  local factor=tonumber(spec.factor)  or 0
  local hfactor=tonumber(spec.hfactor) or factor
  local vfactor=tonumber(spec.vfactor) or factor
  local delta=tonumber(spec.delta)   or 1
  local wdelta=tonumber(spec.wdelta)  or delta
  local hdelta=tonumber(spec.hdelta)  or delta
  local ddelta=tonumber(spec.ddelta)  or hdelta
  local vshift=tonumber(spec.vshift)  or 0
  local slant=spec.slant
  local extend=spec.extend
  local squeeze=spec.squeeze
  if slant then
   initializeslant(tfmdata,slant)
  end
  if extend then
   initializeextend(tfmdata,extend)
  end
  if squeeze then
   initializesqueeze(tfmdata,squeeze)
  end
  properties.effect={
   effect=effect,
   width=width,
   factor=factor,
   hfactor=hfactor,
   vfactor=vfactor,
   wdelta=wdelta,
   hdelta=hdelta,
   ddelta=ddelta,
   vshift=vshift,
   slant=tfmdata.parameters.slantfactor,
   extend=tfmdata.parameters.extendfactor,
   squeeze=tfmdata.parameters.squeezefactor,
  }
 end
end
local rules={
 "RadicalRuleThickness",
 "OverbarRuleThickness",
 "FractionRuleThickness",
 "UnderbarRuleThickness",
}
local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier)
 if dy~=0 then
  for i=1,#rules do
   local name=rules[i]
   local value=mathparameters[name]
   if value then
      mathparameters[name]=(squeeze or 1)*(value+dy)
   end
  end
 end
end
local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta)
 local function wdpatch(char)
  if wsnap~=0 then
   char.width=char.width+wdelta/2
  end
 end
 local function htpatch(char)
  if hsnap~=0 then
   local height=char.height
   if height then
    char.height=char.height+2*dy
   end
  end
 end
 local character=characters[0x221A]
 if character and character.next then
  local char=character
  local next=character.next
  wdpatch(char)
  htpatch(char)
  while next do
   char=characters[next]
   wdpatch(char)
   htpatch(char)
   next=char.next
  end
  if char then
   local v=char.vert_variants
   if v then
    local top=v[#v]
    if top then
     local char=characters[top.glyph]
     htpatch(char)
    end
   end
  end
 end
end
local function manipulateeffect(tfmdata)
 local effect=tfmdata.properties.effect
 if effect then
  local characters=tfmdata.characters
  local parameters=tfmdata.parameters
  local mathparameters=tfmdata.mathparameters
  local multiplier=effect.width*100
  local factor=parameters.factor
  local hfactor=parameters.hfactor
  local vfactor=parameters.vfactor
  local wdelta=effect.wdelta*hfactor*multiplier
  local hdelta=effect.hdelta*vfactor*multiplier
  local ddelta=effect.ddelta*vfactor*multiplier
  local vshift=effect.vshift*vfactor*multiplier
  local squeeze=effect.squeeze
  local hshift=wdelta/2
  local dx=multiplier*vfactor
  local dy=vshift
  local factor=(1+effect.factor)*factor
  local hfactor=(1+effect.hfactor)*hfactor
  local vfactor=(1+effect.vfactor)*vfactor
  vshift=vshift~=0 and upcommand[vshift] or false
  hshift=rightcommand[hshift]
  for unicode,character in next,characters do
   local oldwidth=character.width
   local oldheight=character.height
   local olddepth=character.depth
   if oldwidth and oldwidth>0 then
    character.width=oldwidth+wdelta
    local commands=character.commands
    if vshift then
     if commands then
      prependcommands (commands,
       hshift,
       vshift
      )
     else
      character.commands={
       hshift,
       vshift,
       charcommand[unicode]
      }
     end
    else
     if commands then
       prependcommands (commands,
        hshift
       )
     else
      character.commands={
       hshift,
       charcommand[unicode]
       }
     end
    end
   end
   if oldheight and oldheight>0 then
      character.height=oldheight+hdelta
   end
   if olddepth and olddepth>0 then
      character.depth=olddepth+ddelta
   end
  end
  if mathparameters then
   setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier)
   setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta)
  end
  parameters.factor=factor
  parameters.hfactor=hfactor
  parameters.vfactor=vfactor
  if trace then
   report_effect("applying")
   report_effect("  effect  : %s",effect.effect)
   report_effect("  width   : %s => %s",effect.width,multiplier)
   report_effect("  factor  : %s => %s",effect.factor,factor )
   report_effect("  hfactor : %s => %s",effect.hfactor,hfactor)
   report_effect("  vfactor : %s => %s",effect.vfactor,vfactor)
   report_effect("  wdelta  : %s => %s",effect.wdelta,wdelta)
   report_effect("  hdelta  : %s => %s",effect.hdelta,hdelta)
   report_effect("  ddelta  : %s => %s",effect.ddelta,ddelta)
  end
 end
end
local specification={
 name="effect",
 description="apply effects to glyphs",
 initializers={
  base=initializeeffect,
  node=initializeeffect,
 },
 manipulators={
  base=manipulateeffect,
  node=manipulateeffect,
 },
}
registerotffeature(specification)
registerafmfeature(specification)
local function initializeoutline(tfmdata,value)
 value=tonumber(value)
 if not value then
  value=0
 else
  value=tonumber(value) or 0
 end
 local parameters=tfmdata.parameters
 local properties=tfmdata.properties
 parameters.mode=effects.outline
 parameters.width=value*1000
 properties.effect={
  effect=effect,
  width=width,
 }
end
local specification={
 name="outline",
 description="outline glyphs",
 initializers={
  base=initializeoutline,
  node=initializeoutline,
 }
}
registerotffeature(specification)
registerafmfeature(specification)

end --- [luaotfload, fontloader-2022-02-24.lua scope for “font-imp-effects”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-lig” fbd251eea3810a43a8d5542319361d68] ---


fonts.handlers.otf.addfeature {
 ["dataset"]={
  {
   ["data"]={
 ["À"]={ "A","̀" },
 ["Á"]={ "A","́" },
 ["Â"]={ "A","̂" },
 ["Ã"]={ "A","̃" },
 ["Ä"]={ "A","̈" },
 ["Å"]={ "A","̊" },
 ["Ç"]={ "C","̧" },
 ["È"]={ "E","̀" },
 ["É"]={ "E","́" },
 ["Ê"]={ "E","̂" },
 ["Ë"]={ "E","̈" },
 ["Ì"]={ "I","̀" },
 ["Í"]={ "I","́" },
 ["Î"]={ "I","̂" },
 ["Ï"]={ "I","̈" },
 ["Ñ"]={ "N","̃" },
 ["Ò"]={ "O","̀" },
 ["Ó"]={ "O","́" },
 ["Ô"]={ "O","̂" },
 ["Õ"]={ "O","̃" },
 ["Ö"]={ "O","̈" },
 ["Ù"]={ "U","̀" },
 ["Ú"]={ "U","́" },
 ["Û"]={ "U","̂" },
 ["Ü"]={ "U","̈" },
 ["Ý"]={ "Y","́" },
 ["à"]={ "a","̀" },
 ["á"]={ "a","́" },
 ["â"]={ "a","̂" },
 ["ã"]={ "a","̃" },
 ["ä"]={ "a","̈" },
 ["å"]={ "a","̊" },
 ["ç"]={ "c","̧" },
 ["è"]={ "e","̀" },
 ["é"]={ "e","́" },
 ["ê"]={ "e","̂" },
 ["ë"]={ "e","̈" },
 ["ì"]={ "i","̀" },
 ["í"]={ "i","́" },
 ["î"]={ "i","̂" },
 ["ï"]={ "i","̈" },
 ["ñ"]={ "n","̃" },
 ["ò"]={ "o","̀" },
 ["ó"]={ "o","́" },
 ["ô"]={ "o","̂" },
 ["õ"]={ "o","̃" },
 ["ö"]={ "o","̈" },
 ["ù"]={ "u","̀" },
 ["ú"]={ "u","́" },
 ["û"]={ "u","̂" },
 ["ü"]={ "u","̈" },
 ["ý"]={ "y","́" },
 ["ÿ"]={ "y","̈" },
 ["Ā"]={ "A","̄" },
 ["ā"]={ "a","̄" },
 ["Ă"]={ "A","̆" },
 ["ă"]={ "a","̆" },
 ["Ą"]={ "A","̨" },
 ["ą"]={ "a","̨" },
 ["Ć"]={ "C","́" },
 ["ć"]={ "c","́" },
 ["Ĉ"]={ "C","̂" },
 ["ĉ"]={ "c","̂" },
 ["Ċ"]={ "C","̇" },
 ["ċ"]={ "c","̇" },
 ["Č"]={ "C","̌" },
 ["č"]={ "c","̌" },
 ["Ď"]={ "D","̌" },
 ["ď"]={ "d","̌" },
 ["Ē"]={ "E","̄" },
 ["ē"]={ "e","̄" },
 ["Ĕ"]={ "E","̆" },
 ["ĕ"]={ "e","̆" },
 ["Ė"]={ "E","̇" },
 ["ė"]={ "e","̇" },
 ["Ę"]={ "E","̨" },
 ["ę"]={ "e","̨" },
 ["Ě"]={ "E","̌" },
 ["ě"]={ "e","̌" },
 ["Ĝ"]={ "G","̂" },
 ["ĝ"]={ "g","̂" },
 ["Ğ"]={ "G","̆" },
 ["ğ"]={ "g","̆" },
 ["Ġ"]={ "G","̇" },
 ["ġ"]={ "g","̇" },
 ["Ģ"]={ "G","̧" },
 ["ģ"]={ "g","̧" },
 ["Ĥ"]={ "H","̂" },
 ["ĥ"]={ "h","̂" },
 ["Ĩ"]={ "I","̃" },
 ["ĩ"]={ "i","̃" },
 ["Ī"]={ "I","̄" },
 ["ī"]={ "i","̄" },
 ["Ĭ"]={ "I","̆" },
 ["ĭ"]={ "i","̆" },
 ["Į"]={ "I","̨" },
 ["į"]={ "i","̨" },
 ["İ"]={ "I","̇" },
 ["Ĵ"]={ "J","̂" },
 ["ĵ"]={ "j","̂" },
 ["Ķ"]={ "K","̧" },
 ["ķ"]={ "k","̧" },
 ["Ĺ"]={ "L","́" },
 ["ĺ"]={ "l","́" },
 ["Ļ"]={ "L","̧" },
 ["ļ"]={ "l","̧" },
 ["Ľ"]={ "L","̌" },
 ["ľ"]={ "l","̌" },
 ["Ń"]={ "N","́" },
 ["ń"]={ "n","́" },
 ["Ņ"]={ "N","̧" },
 ["ņ"]={ "n","̧" },
 ["Ň"]={ "N","̌" },
 ["ň"]={ "n","̌" },
 ["Ō"]={ "O","̄" },
 ["ō"]={ "o","̄" },
 ["Ŏ"]={ "O","̆" },
 ["ŏ"]={ "o","̆" },
 ["Ő"]={ "O","̋" },
 ["ő"]={ "o","̋" },
 ["Ŕ"]={ "R","́" },
 ["ŕ"]={ "r","́" },
 ["Ŗ"]={ "R","̧" },
 ["ŗ"]={ "r","̧" },
 ["Ř"]={ "R","̌" },
 ["ř"]={ "r","̌" },
 ["Ś"]={ "S","́" },
 ["ś"]={ "s","́" },
 ["Ŝ"]={ "S","̂" },
 ["ŝ"]={ "s","̂" },
 ["Ş"]={ "S","̧" },
 ["ş"]={ "s","̧" },
 ["Š"]={ "S","̌" },
 ["š"]={ "s","̌" },
 ["Ţ"]={ "T","̧" },
 ["ţ"]={ "t","̧" },
 ["Ť"]={ "T","̌" },
 ["ť"]={ "t","̌" },
 ["Ũ"]={ "U","̃" },
 ["ũ"]={ "u","̃" },
 ["Ū"]={ "U","̄" },
 ["ū"]={ "u","̄" },
 ["Ŭ"]={ "U","̆" },
 ["ŭ"]={ "u","̆" },
 ["Ů"]={ "U","̊" },
 ["ů"]={ "u","̊" },
 ["Ű"]={ "U","̋" },
 ["ű"]={ "u","̋" },
 ["Ų"]={ "U","̨" },
 ["ų"]={ "u","̨" },
 ["Ŵ"]={ "W","̂" },
 ["ŵ"]={ "w","̂" },
 ["Ŷ"]={ "Y","̂" },
 ["ŷ"]={ "y","̂" },
 ["Ÿ"]={ "Y","̈" },
 ["Ź"]={ "Z","́" },
 ["ź"]={ "z","́" },
 ["Ż"]={ "Z","̇" },
 ["ż"]={ "z","̇" },
 ["Ž"]={ "Z","̌" },
 ["ž"]={ "z","̌" },
 ["Ơ"]={ "O","̛" },
 ["ơ"]={ "o","̛" },
 ["Ư"]={ "U","̛" },
 ["ư"]={ "u","̛" },
 ["Ǎ"]={ "A","̌" },
 ["ǎ"]={ "a","̌" },
 ["Ǐ"]={ "I","̌" },
 ["ǐ"]={ "i","̌" },
 ["Ǒ"]={ "O","̌" },
 ["ǒ"]={ "o","̌" },
 ["Ǔ"]={ "U","̌" },
 ["ǔ"]={ "u","̌" },
 ["Ǖ"]={ "Ü","̄" },
 ["ǖ"]={ "ü","̄" },
 ["Ǘ"]={ "Ü","́" },
 ["ǘ"]={ "ü","́" },
 ["Ǚ"]={ "Ü","̌" },
 ["ǚ"]={ "ü","̌" },
 ["Ǜ"]={ "Ü","̀" },
 ["ǜ"]={ "ü","̀" },
 ["Ǟ"]={ "Ä","̄" },
 ["ǟ"]={ "ä","̄" },
 ["Ǡ"]={ "Ȧ","̄" },
 ["ǡ"]={ "ȧ","̄" },
 ["Ǣ"]={ "Æ","̄" },
 ["ǣ"]={ "æ","̄" },
 ["Ǧ"]={ "G","̌" },
 ["ǧ"]={ "g","̌" },
 ["Ǩ"]={ "K","̌" },
 ["ǩ"]={ "k","̌" },
 ["Ǫ"]={ "O","̨" },
 ["ǫ"]={ "o","̨" },
 ["Ǭ"]={ "Ǫ","̄" },
 ["ǭ"]={ "ǫ","̄" },
 ["Ǯ"]={ "Ʒ","̌" },
 ["ǯ"]={ "ʒ","̌" },
 ["ǰ"]={ "j","̌" },
 ["Ǵ"]={ "G","́" },
 ["ǵ"]={ "g","́" },
 ["Ǹ"]={ "N","̀" },
 ["ǹ"]={ "n","̀" },
 ["Ǻ"]={ "Å","́" },
 ["ǻ"]={ "å","́" },
 ["Ǽ"]={ "Æ","́" },
 ["ǽ"]={ "æ","́" },
 ["Ǿ"]={ "Ø","́" },
 ["ǿ"]={ "ø","́" },
 ["Ȁ"]={ "A","̏" },
 ["ȁ"]={ "a","̏" },
 ["Ȃ"]={ "A","̑" },
 ["ȃ"]={ "a","̑" },
 ["Ȅ"]={ "E","̏" },
 ["ȅ"]={ "e","̏" },
 ["Ȇ"]={ "E","̑" },
 ["ȇ"]={ "e","̑" },
 ["Ȉ"]={ "I","̏" },
 ["ȉ"]={ "i","̏" },
 ["Ȋ"]={ "I","̑" },
 ["ȋ"]={ "i","̑" },
 ["Ȍ"]={ "O","̏" },
 ["ȍ"]={ "o","̏" },
 ["Ȏ"]={ "O","̑" },
 ["ȏ"]={ "o","̑" },
 ["Ȑ"]={ "R","̏" },
 ["ȑ"]={ "r","̏" },
 ["Ȓ"]={ "R","̑" },
 ["ȓ"]={ "r","̑" },
 ["Ȕ"]={ "U","̏" },
 ["ȕ"]={ "u","̏" },
 ["Ȗ"]={ "U","̑" },
 ["ȗ"]={ "u","̑" },
 ["Ș"]={ "S","̦" },
 ["ș"]={ "s","̦" },
 ["Ț"]={ "T","̦" },
 ["ț"]={ "t","̦" },
 ["Ȟ"]={ "H","̌" },
 ["ȟ"]={ "h","̌" },
 ["Ȧ"]={ "A","̇" },
 ["ȧ"]={ "a","̇" },
 ["Ȩ"]={ "E","̧" },
 ["ȩ"]={ "e","̧" },
 ["Ȫ"]={ "Ö","̄" },
 ["ȫ"]={ "ö","̄" },
 ["Ȭ"]={ "Õ","̄" },
 ["ȭ"]={ "õ","̄" },
 ["Ȯ"]={ "O","̇" },
 ["ȯ"]={ "o","̇" },
 ["Ȱ"]={ "Ȯ","̄" },
 ["ȱ"]={ "ȯ","̄" },
 ["Ȳ"]={ "Y","̄" },
 ["ȳ"]={ "y","̄" },
 ["̈́"]={ "̈","́" },
 ["΅"]={ "¨","́" },
 ["Ά"]={ "Α","́" },
 ["Έ"]={ "Ε","́" },
 ["Ή"]={ "Η","́" },
 ["Ί"]={ "Ι","́" },
 ["Ό"]={ "Ο","́" },
 ["Ύ"]={ "Υ","́" },
 ["Ώ"]={ "Ω","́" },
 ["ΐ"]={ "ϊ","́" },
 ["Ϊ"]={ "Ι","̈" },
 ["Ϋ"]={ "Υ","̈" },
 ["ά"]={ "α","́" },
 ["έ"]={ "ε","́" },
 ["ή"]={ "η","́" },
 ["ί"]={ "ι","́" },
 ["ΰ"]={ "ϋ","́" },
 ["ϊ"]={ "ι","̈" },
 ["ϋ"]={ "υ","̈" },
 ["ό"]={ "ο","́" },
 ["ύ"]={ "υ","́" },
 ["ώ"]={ "ω","́" },
 ["ϓ"]={ "ϒ","́" },
 ["ϔ"]={ "ϒ","̈" },
 ["Ѐ"]={ "Е","̀" },
 ["Ё"]={ "Е","̈" },
 ["Ѓ"]={ "Г","́" },
 ["Ї"]={ "І","̈" },
 ["Ќ"]={ "К","́" },
 ["Ѝ"]={ "И","̀" },
 ["Ў"]={ "У","̆" },
 ["Й"]={ "И","̆" },
 ["й"]={ "и","̆" },
 ["ѐ"]={ "е","̀" },
 ["ё"]={ "е","̈" },
 ["ѓ"]={ "г","́" },
 ["ї"]={ "і","̈" },
 ["ќ"]={ "к","́" },
 ["ѝ"]={ "и","̀" },
 ["ў"]={ "у","̆" },
 ["Ѷ"]={ "Ѵ","̏" },
 ["ѷ"]={ "ѵ","̏" },
 ["Ӂ"]={ "Ж","̆" },
 ["ӂ"]={ "ж","̆" },
 ["Ӑ"]={ "А","̆" },
 ["ӑ"]={ "а","̆" },
 ["Ӓ"]={ "А","̈" },
 ["ӓ"]={ "а","̈" },
 ["Ӗ"]={ "Е","̆" },
 ["ӗ"]={ "е","̆" },
 ["Ӛ"]={ "Ә","̈" },
 ["ӛ"]={ "ә","̈" },
 ["Ӝ"]={ "Ж","̈" },
 ["ӝ"]={ "ж","̈" },
 ["Ӟ"]={ "З","̈" },
 ["ӟ"]={ "з","̈" },
 ["Ӣ"]={ "И","̄" },
 ["ӣ"]={ "и","̄" },
 ["Ӥ"]={ "И","̈" },
 ["ӥ"]={ "и","̈" },
 ["Ӧ"]={ "О","̈" },
 ["ӧ"]={ "о","̈" },
 ["Ӫ"]={ "Ө","̈" },
 ["ӫ"]={ "ө","̈" },
 ["Ӭ"]={ "Э","̈" },
 ["ӭ"]={ "э","̈" },
 ["Ӯ"]={ "У","̄" },
 ["ӯ"]={ "у","̄" },
 ["Ӱ"]={ "У","̈" },
 ["ӱ"]={ "у","̈" },
 ["Ӳ"]={ "У","̋" },
 ["ӳ"]={ "у","̋" },
 ["Ӵ"]={ "Ч","̈" },
 ["ӵ"]={ "ч","̈" },
 ["Ӹ"]={ "Ы","̈" },
 ["ӹ"]={ "ы","̈" },
 ["آ"]={ "ا","ٓ" },
 ["أ"]={ "ا","ٔ" },
 ["ؤ"]={ "و","ٔ" },
 ["إ"]={ "ا","ٕ" },
 ["ئ"]={ "ي","ٔ" },
 ["ۀ"]={ "ە","ٔ" },
 ["ۂ"]={ "ہ","ٔ" },
 ["ۓ"]={ "ے","ٔ" },
 ["ऩ"]={ "न","़" },
 ["ऱ"]={ "र","़" },
 ["ऴ"]={ "ळ","़" },
 ["क़"]={ "क","़" },
 ["ख़"]={ "ख","़" },
 ["ग़"]={ "ग","़" },
 ["ज़"]={ "ज","़" },
 ["ड़"]={ "ड","़" },
 ["ढ़"]={ "ढ","़" },
 ["फ़"]={ "फ","़" },
 ["य़"]={ "य","़" },
 ["ো"]={ "ে","া" },
 ["ৌ"]={ "ে","ৗ" },
 ["ড়"]={ "ড","়" },
 ["ঢ়"]={ "ঢ","়" },
 ["য়"]={ "য","়" },
 ["ਲ਼"]={ "ਲ","਼" },
 ["ਸ਼"]={ "ਸ","਼" },
 ["ਖ਼"]={ "ਖ","਼" },
 ["ਗ਼"]={ "ਗ","਼" },
 ["ਜ਼"]={ "ਜ","਼" },
 ["ਫ਼"]={ "ਫ","਼" },
 ["ୈ"]={ "େ","ୖ" },
 ["ୋ"]={ "େ","ା" },
 ["ୌ"]={ "େ","ୗ" },
 ["ଡ଼"]={ "ଡ","଼" },
 ["ଢ଼"]={ "ଢ","଼" },
 ["ஔ"]={ "ஒ","ௗ" },
 ["ொ"]={ "ெ","ா" },
 ["ோ"]={ "ே","ா" },
 ["ௌ"]={ "ெ","ௗ" },
 ["ై"]={ "ె","ౖ" },
 ["ೀ"]={ "ಿ","ೕ" },
 ["ೇ"]={ "ೆ","ೕ" },
 ["ೈ"]={ "ೆ","ೖ" },
 ["ೊ"]={ "ೆ","ೂ" },
 ["ೋ"]={ "ೊ","ೕ" },
 ["ൊ"]={ "െ","ാ" },
 ["ോ"]={ "േ","ാ" },
 ["ൌ"]={ "െ","ൗ" },
 ["ේ"]={ "ෙ","්" },
 ["ො"]={ "ෙ","ා" },
 ["ෝ"]={ "ො","්" },
 ["ෞ"]={ "ෙ","ෟ" },
 ["གྷ"]={ "ག","ྷ" },
 ["ཌྷ"]={ "ཌ","ྷ" },
 ["དྷ"]={ "ད","ྷ" },
 ["བྷ"]={ "བ","ྷ" },
 ["ཛྷ"]={ "ཛ","ྷ" },
 ["ཀྵ"]={ "ཀ","ྵ" },
 ["ཱི"]={ "ཱ","ི" },
 ["ཱུ"]={ "ཱ","ུ" },
 ["ྲྀ"]={ "ྲ","ྀ" },
 ["ླྀ"]={ "ླ","ྀ" },
 ["ཱྀ"]={ "ཱ","ྀ" },
 ["ྒྷ"]={ "ྒ","ྷ" },
 ["ྜྷ"]={ "ྜ","ྷ" },
 ["ྡྷ"]={ "ྡ","ྷ" },
 ["ྦྷ"]={ "ྦ","ྷ" },
 ["ྫྷ"]={ "ྫ","ྷ" },
 ["ྐྵ"]={ "ྐ","ྵ" },
 ["ဦ"]={ "ဥ","ီ" },
 ["ᬆ"]={ "ᬅ","ᬵ" },
 ["ᬈ"]={ "ᬇ","ᬵ" },
 ["ᬊ"]={ "ᬉ","ᬵ" },
 ["ᬌ"]={ "ᬋ","ᬵ" },
 ["ᬎ"]={ "ᬍ","ᬵ" },
 ["ᬒ"]={ "ᬑ","ᬵ" },
 ["ᬻ"]={ "ᬺ","ᬵ" },
 ["ᬽ"]={ "ᬼ","ᬵ" },
 ["ᭀ"]={ "ᬾ","ᬵ" },
 ["ᭁ"]={ "ᬿ","ᬵ" },
 ["ᭃ"]={ "ᭂ","ᬵ" },
 ["Ḁ"]={ "A","̥" },
 ["ḁ"]={ "a","̥" },
 ["Ḃ"]={ "B","̇" },
 ["ḃ"]={ "b","̇" },
 ["Ḅ"]={ "B","̣" },
 ["ḅ"]={ "b","̣" },
 ["Ḇ"]={ "B","̱" },
 ["ḇ"]={ "b","̱" },
 ["Ḉ"]={ "Ç","́" },
 ["ḉ"]={ "ç","́" },
 ["Ḋ"]={ "D","̇" },
 ["ḋ"]={ "d","̇" },
 ["Ḍ"]={ "D","̣" },
 ["ḍ"]={ "d","̣" },
 ["Ḏ"]={ "D","̱" },
 ["ḏ"]={ "d","̱" },
 ["Ḑ"]={ "D","̧" },
 ["ḑ"]={ "d","̧" },
 ["Ḓ"]={ "D","̭" },
 ["ḓ"]={ "d","̭" },
 ["Ḕ"]={ "Ē","̀" },
 ["ḕ"]={ "ē","̀" },
 ["Ḗ"]={ "Ē","́" },
 ["ḗ"]={ "ē","́" },
 ["Ḙ"]={ "E","̭" },
 ["ḙ"]={ "e","̭" },
 ["Ḛ"]={ "E","̰" },
 ["ḛ"]={ "e","̰" },
 ["Ḝ"]={ "Ȩ","̆" },
 ["ḝ"]={ "ȩ","̆" },
 ["Ḟ"]={ "F","̇" },
 ["ḟ"]={ "f","̇" },
 ["Ḡ"]={ "G","̄" },
 ["ḡ"]={ "g","̄" },
 ["Ḣ"]={ "H","̇" },
 ["ḣ"]={ "h","̇" },
 ["Ḥ"]={ "H","̣" },
 ["ḥ"]={ "h","̣" },
 ["Ḧ"]={ "H","̈" },
 ["ḧ"]={ "h","̈" },
 ["Ḩ"]={ "H","̧" },
 ["ḩ"]={ "h","̧" },
 ["Ḫ"]={ "H","̮" },
 ["ḫ"]={ "h","̮" },
 ["Ḭ"]={ "I","̰" },
 ["ḭ"]={ "i","̰" },
 ["Ḯ"]={ "Ï","́" },
 ["ḯ"]={ "ï","́" },
 ["Ḱ"]={ "K","́" },
 ["ḱ"]={ "k","́" },
 ["Ḳ"]={ "K","̣" },
 ["ḳ"]={ "k","̣" },
 ["Ḵ"]={ "K","̱" },
 ["ḵ"]={ "k","̱" },
 ["Ḷ"]={ "L","̣" },
 ["ḷ"]={ "l","̣" },
 ["Ḹ"]={ "Ḷ","̄" },
 ["ḹ"]={ "ḷ","̄" },
 ["Ḻ"]={ "L","̱" },
 ["ḻ"]={ "l","̱" },
 ["Ḽ"]={ "L","̭" },
 ["ḽ"]={ "l","̭" },
 ["Ḿ"]={ "M","́" },
 ["ḿ"]={ "m","́" },
 ["Ṁ"]={ "M","̇" },
 ["ṁ"]={ "m","̇" },
 ["Ṃ"]={ "M","̣" },
 ["ṃ"]={ "m","̣" },
 ["Ṅ"]={ "N","̇" },
 ["ṅ"]={ "n","̇" },
 ["Ṇ"]={ "N","̣" },
 ["ṇ"]={ "n","̣" },
 ["Ṉ"]={ "N","̱" },
 ["ṉ"]={ "n","̱" },
 ["Ṋ"]={ "N","̭" },
 ["ṋ"]={ "n","̭" },
 ["Ṍ"]={ "Õ","́" },
 ["ṍ"]={ "õ","́" },
 ["Ṏ"]={ "Õ","̈" },
 ["ṏ"]={ "õ","̈" },
 ["Ṑ"]={ "Ō","̀" },
 ["ṑ"]={ "ō","̀" },
 ["Ṓ"]={ "Ō","́" },
 ["ṓ"]={ "ō","́" },
 ["Ṕ"]={ "P","́" },
 ["ṕ"]={ "p","́" },
 ["Ṗ"]={ "P","̇" },
 ["ṗ"]={ "p","̇" },
 ["Ṙ"]={ "R","̇" },
 ["ṙ"]={ "r","̇" },
 ["Ṛ"]={ "R","̣" },
 ["ṛ"]={ "r","̣" },
 ["Ṝ"]={ "Ṛ","̄" },
 ["ṝ"]={ "ṛ","̄" },
 ["Ṟ"]={ "R","̱" },
 ["ṟ"]={ "r","̱" },
 ["Ṡ"]={ "S","̇" },
 ["ṡ"]={ "s","̇" },
 ["Ṣ"]={ "S","̣" },
 ["ṣ"]={ "s","̣" },
 ["Ṥ"]={ "Ś","̇" },
 ["ṥ"]={ "ś","̇" },
 ["Ṧ"]={ "Š","̇" },
 ["ṧ"]={ "š","̇" },
 ["Ṩ"]={ "Ṣ","̇" },
 ["ṩ"]={ "ṣ","̇" },
 ["Ṫ"]={ "T","̇" },
 ["ṫ"]={ "t","̇" },
 ["Ṭ"]={ "T","̣" },
 ["ṭ"]={ "t","̣" },
 ["Ṯ"]={ "T","̱" },
 ["ṯ"]={ "t","̱" },
 ["Ṱ"]={ "T","̭" },
 ["ṱ"]={ "t","̭" },
 ["Ṳ"]={ "U","̤" },
 ["ṳ"]={ "u","̤" },
 ["Ṵ"]={ "U","̰" },
 ["ṵ"]={ "u","̰" },
 ["Ṷ"]={ "U","̭" },
 ["ṷ"]={ "u","̭" },
 ["Ṹ"]={ "Ũ","́" },
 ["ṹ"]={ "ũ","́" },
 ["Ṻ"]={ "Ū","̈" },
 ["ṻ"]={ "ū","̈" },
 ["Ṽ"]={ "V","̃" },
 ["ṽ"]={ "v","̃" },
 ["Ṿ"]={ "V","̣" },
 ["ṿ"]={ "v","̣" },
 ["Ẁ"]={ "W","̀" },
 ["ẁ"]={ "w","̀" },
 ["Ẃ"]={ "W","́" },
 ["ẃ"]={ "w","́" },
 ["Ẅ"]={ "W","̈" },
 ["ẅ"]={ "w","̈" },
 ["Ẇ"]={ "W","̇" },
 ["ẇ"]={ "w","̇" },
 ["Ẉ"]={ "W","̣" },
 ["ẉ"]={ "w","̣" },
 ["Ẋ"]={ "X","̇" },
 ["ẋ"]={ "x","̇" },
 ["Ẍ"]={ "X","̈" },
 ["ẍ"]={ "x","̈" },
 ["Ẏ"]={ "Y","̇" },
 ["ẏ"]={ "y","̇" },
 ["Ẑ"]={ "Z","̂" },
 ["ẑ"]={ "z","̂" },
 ["Ẓ"]={ "Z","̣" },
 ["ẓ"]={ "z","̣" },
 ["Ẕ"]={ "Z","̱" },
 ["ẕ"]={ "z","̱" },
 ["ẖ"]={ "h","̱" },
 ["ẗ"]={ "t","̈" },
 ["ẘ"]={ "w","̊" },
 ["ẙ"]={ "y","̊" },
 ["ẛ"]={ "ſ","̇" },
 ["Ạ"]={ "A","̣" },
 ["ạ"]={ "a","̣" },
 ["Ả"]={ "A","̉" },
 ["ả"]={ "a","̉" },
 ["Ấ"]={ "Â","́" },
 ["ấ"]={ "â","́" },
 ["Ầ"]={ "Â","̀" },
 ["ầ"]={ "â","̀" },
 ["Ẩ"]={ "Â","̉" },
 ["ẩ"]={ "â","̉" },
 ["Ẫ"]={ "Â","̃" },
 ["ẫ"]={ "â","̃" },
 ["Ậ"]={ "Ạ","̂" },
 ["ậ"]={ "ạ","̂" },
 ["Ắ"]={ "Ă","́" },
 ["ắ"]={ "ă","́" },
 ["Ằ"]={ "Ă","̀" },
 ["ằ"]={ "ă","̀" },
 ["Ẳ"]={ "Ă","̉" },
 ["ẳ"]={ "ă","̉" },
 ["Ẵ"]={ "Ă","̃" },
 ["ẵ"]={ "ă","̃" },
 ["Ặ"]={ "Ạ","̆" },
 ["ặ"]={ "ạ","̆" },
 ["Ẹ"]={ "E","̣" },
 ["ẹ"]={ "e","̣" },
 ["Ẻ"]={ "E","̉" },
 ["ẻ"]={ "e","̉" },
 ["Ẽ"]={ "E","̃" },
 ["ẽ"]={ "e","̃" },
 ["Ế"]={ "Ê","́" },
 ["ế"]={ "ê","́" },
 ["Ề"]={ "Ê","̀" },
 ["ề"]={ "ê","̀" },
 ["Ể"]={ "Ê","̉" },
 ["ể"]={ "ê","̉" },
 ["Ễ"]={ "Ê","̃" },
 ["ễ"]={ "ê","̃" },
 ["Ệ"]={ "Ẹ","̂" },
 ["ệ"]={ "ẹ","̂" },
 ["Ỉ"]={ "I","̉" },
 ["ỉ"]={ "i","̉" },
 ["Ị"]={ "I","̣" },
 ["ị"]={ "i","̣" },
 ["Ọ"]={ "O","̣" },
 ["ọ"]={ "o","̣" },
 ["Ỏ"]={ "O","̉" },
 ["ỏ"]={ "o","̉" },
 ["Ố"]={ "Ô","́" },
 ["ố"]={ "ô","́" },
 ["Ồ"]={ "Ô","̀" },
 ["ồ"]={ "ô","̀" },
 ["Ổ"]={ "Ô","̉" },
 ["ổ"]={ "ô","̉" },
 ["Ỗ"]={ "Ô","̃" },
 ["ỗ"]={ "ô","̃" },
 ["Ộ"]={ "Ọ","̂" },
 ["ộ"]={ "ọ","̂" },
 ["Ớ"]={ "Ơ","́" },
 ["ớ"]={ "ơ","́" },
 ["Ờ"]={ "Ơ","̀" },
 ["ờ"]={ "ơ","̀" },
 ["Ở"]={ "Ơ","̉" },
 ["ở"]={ "ơ","̉" },
 ["Ỡ"]={ "Ơ","̃" },
 ["ỡ"]={ "ơ","̃" },
 ["Ợ"]={ "Ơ","̣" },
 ["ợ"]={ "ơ","̣" },
 ["Ụ"]={ "U","̣" },
 ["ụ"]={ "u","̣" },
 ["Ủ"]={ "U","̉" },
 ["ủ"]={ "u","̉" },
 ["Ứ"]={ "Ư","́" },
 ["ứ"]={ "ư","́" },
 ["Ừ"]={ "Ư","̀" },
 ["ừ"]={ "ư","̀" },
 ["Ử"]={ "Ư","̉" },
 ["ử"]={ "ư","̉" },
 ["Ữ"]={ "Ư","̃" },
 ["ữ"]={ "ư","̃" },
 ["Ự"]={ "Ư","̣" },
 ["ự"]={ "ư","̣" },
 ["Ỳ"]={ "Y","̀" },
 ["ỳ"]={ "y","̀" },
 ["Ỵ"]={ "Y","̣" },
 ["ỵ"]={ "y","̣" },
 ["Ỷ"]={ "Y","̉" },
 ["ỷ"]={ "y","̉" },
 ["Ỹ"]={ "Y","̃" },
 ["ỹ"]={ "y","̃" },
 ["ἀ"]={ "α","̓" },
 ["ἁ"]={ "α","̔" },
 ["ἂ"]={ "ἀ","̀" },
 ["ἃ"]={ "ἁ","̀" },
 ["ἄ"]={ "ἀ","́" },
 ["ἅ"]={ "ἁ","́" },
 ["ἆ"]={ "ἀ","͂" },
 ["ἇ"]={ "ἁ","͂" },
 ["Ἀ"]={ "Α","̓" },
 ["Ἁ"]={ "Α","̔" },
 ["Ἂ"]={ "Ἀ","̀" },
 ["Ἃ"]={ "Ἁ","̀" },
 ["Ἄ"]={ "Ἀ","́" },
 ["Ἅ"]={ "Ἁ","́" },
 ["Ἆ"]={ "Ἀ","͂" },
 ["Ἇ"]={ "Ἁ","͂" },
 ["ἐ"]={ "ε","̓" },
 ["ἑ"]={ "ε","̔" },
 ["ἒ"]={ "ἐ","̀" },
 ["ἓ"]={ "ἑ","̀" },
 ["ἔ"]={ "ἐ","́" },
 ["ἕ"]={ "ἑ","́" },
 ["Ἐ"]={ "Ε","̓" },
 ["Ἑ"]={ "Ε","̔" },
 ["Ἒ"]={ "Ἐ","̀" },
 ["Ἓ"]={ "Ἑ","̀" },
 ["Ἔ"]={ "Ἐ","́" },
 ["Ἕ"]={ "Ἑ","́" },
 ["ἠ"]={ "η","̓" },
 ["ἡ"]={ "η","̔" },
 ["ἢ"]={ "ἠ","̀" },
 ["ἣ"]={ "ἡ","̀" },
 ["ἤ"]={ "ἠ","́" },
 ["ἥ"]={ "ἡ","́" },
 ["ἦ"]={ "ἠ","͂" },
 ["ἧ"]={ "ἡ","͂" },
 ["Ἠ"]={ "Η","̓" },
 ["Ἡ"]={ "Η","̔" },
 ["Ἢ"]={ "Ἠ","̀" },
 ["Ἣ"]={ "Ἡ","̀" },
 ["Ἤ"]={ "Ἠ","́" },
 ["Ἥ"]={ "Ἡ","́" },
 ["Ἦ"]={ "Ἠ","͂" },
 ["Ἧ"]={ "Ἡ","͂" },
 ["ἰ"]={ "ι","̓" },
 ["ἱ"]={ "ι","̔" },
 ["ἲ"]={ "ἰ","̀" },
 ["ἳ"]={ "ἱ","̀" },
 ["ἴ"]={ "ἰ","́" },
 ["ἵ"]={ "ἱ","́" },
 ["ἶ"]={ "ἰ","͂" },
 ["ἷ"]={ "ἱ","͂" },
 ["Ἰ"]={ "Ι","̓" },
 ["Ἱ"]={ "Ι","̔" },
 ["Ἲ"]={ "Ἰ","̀" },
 ["Ἳ"]={ "Ἱ","̀" },
 ["Ἴ"]={ "Ἰ","́" },
 ["Ἵ"]={ "Ἱ","́" },
 ["Ἶ"]={ "Ἰ","͂" },
 ["Ἷ"]={ "Ἱ","͂" },
 ["ὀ"]={ "ο","̓" },
 ["ὁ"]={ "ο","̔" },
 ["ὂ"]={ "ὀ","̀" },
 ["ὃ"]={ "ὁ","̀" },
 ["ὄ"]={ "ὀ","́" },
 ["ὅ"]={ "ὁ","́" },
 ["Ὀ"]={ "Ο","̓" },
 ["Ὁ"]={ "Ο","̔" },
 ["Ὂ"]={ "Ὀ","̀" },
 ["Ὃ"]={ "Ὁ","̀" },
 ["Ὄ"]={ "Ὀ","́" },
 ["Ὅ"]={ "Ὁ","́" },
 ["ὐ"]={ "υ","̓" },
 ["ὑ"]={ "υ","̔" },
 ["ὒ"]={ "ὐ","̀" },
 ["ὓ"]={ "ὑ","̀" },
 ["ὔ"]={ "ὐ","́" },
 ["ὕ"]={ "ὑ","́" },
 ["ὖ"]={ "ὐ","͂" },
 ["ὗ"]={ "ὑ","͂" },
 ["Ὑ"]={ "Υ","̔" },
 ["Ὓ"]={ "Ὑ","̀" },
 ["Ὕ"]={ "Ὑ","́" },
 ["Ὗ"]={ "Ὑ","͂" },
 ["ὠ"]={ "ω","̓" },
 ["ὡ"]={ "ω","̔" },
 ["ὢ"]={ "ὠ","̀" },
 ["ὣ"]={ "ὡ","̀" },
 ["ὤ"]={ "ὠ","́" },
 ["ὥ"]={ "ὡ","́" },
 ["ὦ"]={ "ὠ","͂" },
 ["ὧ"]={ "ὡ","͂" },
 ["Ὠ"]={ "Ω","̓" },
 ["Ὡ"]={ "Ω","̔" },
 ["Ὢ"]={ "Ὠ","̀" },
 ["Ὣ"]={ "Ὡ","̀" },
 ["Ὤ"]={ "Ὠ","́" },
 ["Ὥ"]={ "Ὡ","́" },
 ["Ὦ"]={ "Ὠ","͂" },
 ["Ὧ"]={ "Ὡ","͂" },
 ["ὰ"]={ "α","̀" },
 ["ὲ"]={ "ε","̀" },
 ["ὴ"]={ "η","̀" },
 ["ὶ"]={ "ι","̀" },
 ["ὸ"]={ "ο","̀" },
 ["ὺ"]={ "υ","̀" },
 ["ὼ"]={ "ω","̀" },
 ["ᾀ"]={ "ἀ","ͅ" },
 ["ᾁ"]={ "ἁ","ͅ" },
 ["ᾂ"]={ "ἂ","ͅ" },
 ["ᾃ"]={ "ἃ","ͅ" },
 ["ᾄ"]={ "ἄ","ͅ" },
 ["ᾅ"]={ "ἅ","ͅ" },
 ["ᾆ"]={ "ἆ","ͅ" },
 ["ᾇ"]={ "ἇ","ͅ" },
 ["ᾈ"]={ "Ἀ","ͅ" },
 ["ᾉ"]={ "Ἁ","ͅ" },
 ["ᾊ"]={ "Ἂ","ͅ" },
 ["ᾋ"]={ "Ἃ","ͅ" },
 ["ᾌ"]={ "Ἄ","ͅ" },
 ["ᾍ"]={ "Ἅ","ͅ" },
 ["ᾎ"]={ "Ἆ","ͅ" },
 ["ᾏ"]={ "Ἇ","ͅ" },
 ["ᾐ"]={ "ἠ","ͅ" },
 ["ᾑ"]={ "ἡ","ͅ" },
 ["ᾒ"]={ "ἢ","ͅ" },
 ["ᾓ"]={ "ἣ","ͅ" },
 ["ᾔ"]={ "ἤ","ͅ" },
 ["ᾕ"]={ "ἥ","ͅ" },
 ["ᾖ"]={ "ἦ","ͅ" },
 ["ᾗ"]={ "ἧ","ͅ" },
 ["ᾘ"]={ "Ἠ","ͅ" },
 ["ᾙ"]={ "Ἡ","ͅ" },
 ["ᾚ"]={ "Ἢ","ͅ" },
 ["ᾛ"]={ "Ἣ","ͅ" },
 ["ᾜ"]={ "Ἤ","ͅ" },
 ["ᾝ"]={ "Ἥ","ͅ" },
 ["ᾞ"]={ "Ἦ","ͅ" },
 ["ᾟ"]={ "Ἧ","ͅ" },
 ["ᾠ"]={ "ὠ","ͅ" },
 ["ᾡ"]={ "ὡ","ͅ" },
 ["ᾢ"]={ "ὢ","ͅ" },
 ["ᾣ"]={ "ὣ","ͅ" },
 ["ᾤ"]={ "ὤ","ͅ" },
 ["ᾥ"]={ "ὥ","ͅ" },
 ["ᾦ"]={ "ὦ","ͅ" },
 ["ᾧ"]={ "ὧ","ͅ" },
 ["ᾨ"]={ "Ὠ","ͅ" },
 ["ᾩ"]={ "Ὡ","ͅ" },
 ["ᾪ"]={ "Ὢ","ͅ" },
 ["ᾫ"]={ "Ὣ","ͅ" },
 ["ᾬ"]={ "Ὤ","ͅ" },
 ["ᾭ"]={ "Ὥ","ͅ" },
 ["ᾮ"]={ "Ὦ","ͅ" },
 ["ᾯ"]={ "Ὧ","ͅ" },
 ["ᾰ"]={ "α","̆" },
 ["ᾱ"]={ "α","̄" },
 ["ᾲ"]={ "ὰ","ͅ" },
 ["ᾳ"]={ "α","ͅ" },
 ["ᾴ"]={ "ά","ͅ" },
 ["ᾶ"]={ "α","͂" },
 ["ᾷ"]={ "ᾶ","ͅ" },
 ["Ᾰ"]={ "Α","̆" },
 ["Ᾱ"]={ "Α","̄" },
 ["Ὰ"]={ "Α","̀" },
 ["ᾼ"]={ "Α","ͅ" },
 ["῁"]={ "¨","͂" },
 ["ῂ"]={ "ὴ","ͅ" },
 ["ῃ"]={ "η","ͅ" },
 ["ῄ"]={ "ή","ͅ" },
 ["ῆ"]={ "η","͂" },
 ["ῇ"]={ "ῆ","ͅ" },
 ["Ὲ"]={ "Ε","̀" },
 ["Ὴ"]={ "Η","̀" },
 ["ῌ"]={ "Η","ͅ" },
 ["῍"]={ "᾿","̀" },
 ["῎"]={ "᾿","́" },
 ["῏"]={ "᾿","͂" },
 ["ῐ"]={ "ι","̆" },
 ["ῑ"]={ "ι","̄" },
 ["ῒ"]={ "ϊ","̀" },
 ["ῖ"]={ "ι","͂" },
 ["ῗ"]={ "ϊ","͂" },
 ["Ῐ"]={ "Ι","̆" },
 ["Ῑ"]={ "Ι","̄" },
 ["Ὶ"]={ "Ι","̀" },
 ["῝"]={ "῾","̀" },
 ["῞"]={ "῾","́" },
 ["῟"]={ "῾","͂" },
 ["ῠ"]={ "υ","̆" },
 ["ῡ"]={ "υ","̄" },
 ["ῢ"]={ "ϋ","̀" },
 ["ῤ"]={ "ρ","̓" },
 ["ῥ"]={ "ρ","̔" },
 ["ῦ"]={ "υ","͂" },
 ["ῧ"]={ "ϋ","͂" },
 ["Ῠ"]={ "Υ","̆" },
 ["Ῡ"]={ "Υ","̄" },
 ["Ὺ"]={ "Υ","̀" },
 ["Ῥ"]={ "Ρ","̔" },
 ["῭"]={ "¨","̀" },
 ["ῲ"]={ "ὼ","ͅ" },
 ["ῳ"]={ "ω","ͅ" },
 ["ῴ"]={ "ώ","ͅ" },
 ["ῶ"]={ "ω","͂" },
 ["ῷ"]={ "ῶ","ͅ" },
 ["Ὸ"]={ "Ο","̀" },
 ["Ὼ"]={ "Ω","̀" },
 ["ῼ"]={ "Ω","ͅ" },
 ["↚"]={ "←","̸" },
 ["↛"]={ "→","̸" },
 ["↮"]={ "↔","̸" },
 ["⇍"]={ "⇐","̸" },
 ["⇎"]={ "⇔","̸" },
 ["⇏"]={ "⇒","̸" },
 ["∄"]={ "∃","̸" },
 ["∉"]={ "∈","̸" },
 ["∌"]={ "∋","̸" },
 ["∤"]={ "∣","̸" },
 ["∦"]={ "∥","̸" },
 ["≁"]={ "∼","̸" },
 ["≄"]={ "≃","̸" },
 ["≇"]={ "≅","̸" },
 ["≉"]={ "≈","̸" },
 ["≠"]={ "=","̸" },
 ["≢"]={ "≡","̸" },
 ["≭"]={ "≍","̸" },
 ["≮"]={ "<","̸" },
 ["≯"]={ ">","̸" },
 ["≰"]={ "≤","̸" },
 ["≱"]={ "≥","̸" },
 ["≴"]={ "≲","̸" },
 ["≵"]={ "≳","̸" },
 ["≸"]={ "≶","̸" },
 ["≹"]={ "≷","̸" },
 ["⊀"]={ "≺","̸" },
 ["⊁"]={ "≻","̸" },
 ["⊄"]={ "⊂","̸" },
 ["⊅"]={ "⊃","̸" },
 ["⊈"]={ "⊆","̸" },
 ["⊉"]={ "⊇","̸" },
 ["⊬"]={ "⊢","̸" },
 ["⊭"]={ "⊨","̸" },
 ["⊮"]={ "⊩","̸" },
 ["⊯"]={ "⊫","̸" },
 ["⋠"]={ "≼","̸" },
 ["⋡"]={ "≽","̸" },
 ["⋢"]={ "⊑","̸" },
 ["⋣"]={ "⊒","̸" },
 ["⋪"]={ "⊲","̸" },
 ["⋫"]={ "⊳","̸" },
 ["⋬"]={ "⊴","̸" },
 ["⋭"]={ "⊵","̸" },
 ["⫝̸"]={ "⫝","̸" },
 ["が"]={ "か","゙" },
 ["ぎ"]={ "き","゙" },
 ["ぐ"]={ "く","゙" },
 ["げ"]={ "け","゙" },
 ["ご"]={ "こ","゙" },
 ["ざ"]={ "さ","゙" },
 ["じ"]={ "し","゙" },
 ["ず"]={ "す","゙" },
 ["ぜ"]={ "せ","゙" },
 ["ぞ"]={ "そ","゙" },
 ["だ"]={ "た","゙" },
 ["ぢ"]={ "ち","゙" },
 ["づ"]={ "つ","゙" },
 ["で"]={ "て","゙" },
 ["ど"]={ "と","゙" },
 ["ば"]={ "は","゙" },
 ["ぱ"]={ "は","゚" },
 ["び"]={ "ひ","゙" },
 ["ぴ"]={ "ひ","゚" },
 ["ぶ"]={ "ふ","゙" },
 ["ぷ"]={ "ふ","゚" },
 ["べ"]={ "へ","゙" },
 ["ぺ"]={ "へ","゚" },
 ["ぼ"]={ "ほ","゙" },
 ["ぽ"]={ "ほ","゚" },
 ["ゔ"]={ "う","゙" },
 ["ゞ"]={ "ゝ","゙" },
 ["ガ"]={ "カ","゙" },
 ["ギ"]={ "キ","゙" },
 ["グ"]={ "ク","゙" },
 ["ゲ"]={ "ケ","゙" },
 ["ゴ"]={ "コ","゙" },
 ["ザ"]={ "サ","゙" },
 ["ジ"]={ "シ","゙" },
 ["ズ"]={ "ス","゙" },
 ["ゼ"]={ "セ","゙" },
 ["ゾ"]={ "ソ","゙" },
 ["ダ"]={ "タ","゙" },
 ["ヂ"]={ "チ","゙" },
 ["ヅ"]={ "ツ","゙" },
 ["デ"]={ "テ","゙" },
 ["ド"]={ "ト","゙" },
 ["バ"]={ "ハ","゙" },
 ["パ"]={ "ハ","゚" },
 ["ビ"]={ "ヒ","゙" },
 ["ピ"]={ "ヒ","゚" },
 ["ブ"]={ "フ","゙" },
 ["プ"]={ "フ","゚" },
 ["ベ"]={ "ヘ","゙" },
 ["ペ"]={ "ヘ","゚" },
 ["ボ"]={ "ホ","゙" },
 ["ポ"]={ "ホ","゚" },
 ["ヴ"]={ "ウ","゙" },
 ["ヷ"]={ "ワ","゙" },
 ["ヸ"]={ "ヰ","゙" },
 ["ヹ"]={ "ヱ","゙" },
 ["ヺ"]={ "ヲ","゙" },
 ["ヾ"]={ "ヽ","゙" },
 ["יִ"]={ "י","ִ" },
 ["ײַ"]={ "ײ","ַ" },
 ["שׁ"]={ "ש","ׁ" },
 ["שׂ"]={ "ש","ׂ" },
 ["שּׁ"]={ "שּ","ׁ" },
 ["שּׂ"]={ "שּ","ׂ" },
 ["אַ"]={ "א","ַ" },
 ["אָ"]={ "א","ָ" },
 ["אּ"]={ "א","ּ" },
 ["בּ"]={ "ב","ּ" },
 ["גּ"]={ "ג","ּ" },
 ["דּ"]={ "ד","ּ" },
 ["הּ"]={ "ה","ּ" },
 ["וּ"]={ "ו","ּ" },
 ["זּ"]={ "ז","ּ" },
 ["טּ"]={ "ט","ּ" },
 ["יּ"]={ "י","ּ" },
 ["ךּ"]={ "ך","ּ" },
 ["כּ"]={ "כ","ּ" },
 ["לּ"]={ "ל","ּ" },
 ["מּ"]={ "מ","ּ" },
 ["נּ"]={ "נ","ּ" },
 ["סּ"]={ "ס","ּ" },
 ["ףּ"]={ "ף","ּ" },
 ["פּ"]={ "פ","ּ" },
 ["צּ"]={ "צ","ּ" },
 ["קּ"]={ "ק","ּ" },
 ["רּ"]={ "ר","ּ" },
 ["שּ"]={ "ש","ּ" },
 ["תּ"]={ "ת","ּ" },
 ["וֹ"]={ "ו","ֹ" },
 ["בֿ"]={ "ב","ֿ" },
 ["כֿ"]={ "כ","ֿ" },
 ["פֿ"]={ "פ","ֿ" },
 ["𑂚"]={ "𑂙","𑂺" },
 ["𑂜"]={ "𑂛","𑂺" },
 ["𑂫"]={ "𑂥","𑂺" },
 ["𑄮"]={ "𑄱","𑄧" },
 ["𑄯"]={ "𑄲","𑄧" },
 ["𑍋"]={ "𑍇","𑌾" },
 ["𑍌"]={ "𑍇","𑍗" },
 ["𑒻"]={ "𑒹","𑒺" },
 ["𑒼"]={ "𑒹","𑒰" },
 ["𑒾"]={ "𑒹","𑒽" },
 ["𑖺"]={ "𑖸","𑖯" },
 ["𑖻"]={ "𑖹","𑖯" },
 ["𝅗𝅥"]={ "𝅗","𝅥" },
 ["𝅘𝅥"]={ "𝅘","𝅥" },
 ["𝅘𝅥𝅮"]={ "𝅘𝅥","𝅮" },
 ["𝅘𝅥𝅯"]={ "𝅘𝅥","𝅯" },
 ["𝅘𝅥𝅰"]={ "𝅘𝅥","𝅰" },
 ["𝅘𝅥𝅱"]={ "𝅘𝅥","𝅱" },
 ["𝅘𝅥𝅲"]={ "𝅘𝅥","𝅲" },
 ["𝆹𝅥"]={ "𝆹","𝅥" },
 ["𝆺𝅥"]={ "𝆺","𝅥" },
 ["𝆹𝅥𝅮"]={ "𝆹𝅥","𝅮" },
 ["𝆺𝅥𝅮"]={ "𝆺𝅥","𝅮" },
 ["𝆹𝅥𝅯"]={ "𝆹𝅥","𝅯" },
 ["𝆺𝅥𝅯"]={ "𝆺𝅥","𝅯" },
   },
  },
  {
   ["data"]={
 ["À"]={ "A","̀" },
 ["Á"]={ "A","́" },
 ["Â"]={ "A","̂" },
 ["Ã"]={ "A","̃" },
 ["Ä"]={ "A","̈" },
 ["Å"]={ "A","̊" },
 ["Ç"]={ "C","̧" },
 ["È"]={ "E","̀" },
 ["É"]={ "E","́" },
 ["Ê"]={ "E","̂" },
 ["Ë"]={ "E","̈" },
 ["Ì"]={ "I","̀" },
 ["Í"]={ "I","́" },
 ["Î"]={ "I","̂" },
 ["Ï"]={ "I","̈" },
 ["Ñ"]={ "N","̃" },
 ["Ò"]={ "O","̀" },
 ["Ó"]={ "O","́" },
 ["Ô"]={ "O","̂" },
 ["Õ"]={ "O","̃" },
 ["Ö"]={ "O","̈" },
 ["Ù"]={ "U","̀" },
 ["Ú"]={ "U","́" },
 ["Û"]={ "U","̂" },
 ["Ü"]={ "U","̈" },
 ["Ý"]={ "Y","́" },
 ["à"]={ "a","̀" },
 ["á"]={ "a","́" },
 ["â"]={ "a","̂" },
 ["ã"]={ "a","̃" },
 ["ä"]={ "a","̈" },
 ["å"]={ "a","̊" },
 ["ç"]={ "c","̧" },
 ["è"]={ "e","̀" },
 ["é"]={ "e","́" },
 ["ê"]={ "e","̂" },
 ["ë"]={ "e","̈" },
 ["ì"]={ "i","̀" },
 ["í"]={ "i","́" },
 ["î"]={ "i","̂" },
 ["ï"]={ "i","̈" },
 ["ñ"]={ "n","̃" },
 ["ò"]={ "o","̀" },
 ["ó"]={ "o","́" },
 ["ô"]={ "o","̂" },
 ["õ"]={ "o","̃" },
 ["ö"]={ "o","̈" },
 ["ù"]={ "u","̀" },
 ["ú"]={ "u","́" },
 ["û"]={ "u","̂" },
 ["ü"]={ "u","̈" },
 ["ý"]={ "y","́" },
 ["ÿ"]={ "y","̈" },
 ["Ā"]={ "A","̄" },
 ["ā"]={ "a","̄" },
 ["Ă"]={ "A","̆" },
 ["ă"]={ "a","̆" },
 ["Ą"]={ "A","̨" },
 ["ą"]={ "a","̨" },
 ["Ć"]={ "C","́" },
 ["ć"]={ "c","́" },
 ["Ĉ"]={ "C","̂" },
 ["ĉ"]={ "c","̂" },
 ["Ċ"]={ "C","̇" },
 ["ċ"]={ "c","̇" },
 ["Č"]={ "C","̌" },
 ["č"]={ "c","̌" },
 ["Ď"]={ "D","̌" },
 ["ď"]={ "d","̌" },
 ["Ē"]={ "E","̄" },
 ["ē"]={ "e","̄" },
 ["Ĕ"]={ "E","̆" },
 ["ĕ"]={ "e","̆" },
 ["Ė"]={ "E","̇" },
 ["ė"]={ "e","̇" },
 ["Ę"]={ "E","̨" },
 ["ę"]={ "e","̨" },
 ["Ě"]={ "E","̌" },
 ["ě"]={ "e","̌" },
 ["Ĝ"]={ "G","̂" },
 ["ĝ"]={ "g","̂" },
 ["Ğ"]={ "G","̆" },
 ["ğ"]={ "g","̆" },
 ["Ġ"]={ "G","̇" },
 ["ġ"]={ "g","̇" },
 ["Ģ"]={ "G","̧" },
 ["ģ"]={ "g","̧" },
 ["Ĥ"]={ "H","̂" },
 ["ĥ"]={ "h","̂" },
 ["Ĩ"]={ "I","̃" },
 ["ĩ"]={ "i","̃" },
 ["Ī"]={ "I","̄" },
 ["ī"]={ "i","̄" },
 ["Ĭ"]={ "I","̆" },
 ["ĭ"]={ "i","̆" },
 ["Į"]={ "I","̨" },
 ["į"]={ "i","̨" },
 ["İ"]={ "I","̇" },
 ["Ĵ"]={ "J","̂" },
 ["ĵ"]={ "j","̂" },
 ["Ķ"]={ "K","̧" },
 ["ķ"]={ "k","̧" },
 ["Ĺ"]={ "L","́" },
 ["ĺ"]={ "l","́" },
 ["Ļ"]={ "L","̧" },
 ["ļ"]={ "l","̧" },
 ["Ľ"]={ "L","̌" },
 ["ľ"]={ "l","̌" },
 ["Ń"]={ "N","́" },
 ["ń"]={ "n","́" },
 ["Ņ"]={ "N","̧" },
 ["ņ"]={ "n","̧" },
 ["Ň"]={ "N","̌" },
 ["ň"]={ "n","̌" },
 ["Ō"]={ "O","̄" },
 ["ō"]={ "o","̄" },
 ["Ŏ"]={ "O","̆" },
 ["ŏ"]={ "o","̆" },
 ["Ő"]={ "O","̋" },
 ["ő"]={ "o","̋" },
 ["Ŕ"]={ "R","́" },
 ["ŕ"]={ "r","́" },
 ["Ŗ"]={ "R","̧" },
 ["ŗ"]={ "r","̧" },
 ["Ř"]={ "R","̌" },
 ["ř"]={ "r","̌" },
 ["Ś"]={ "S","́" },
 ["ś"]={ "s","́" },
 ["Ŝ"]={ "S","̂" },
 ["ŝ"]={ "s","̂" },
 ["Ş"]={ "S","̧" },
 ["ş"]={ "s","̧" },
 ["Š"]={ "S","̌" },
 ["š"]={ "s","̌" },
 ["Ţ"]={ "T","̧" },
 ["ţ"]={ "t","̧" },
 ["Ť"]={ "T","̌" },
 ["ť"]={ "t","̌" },
 ["Ũ"]={ "U","̃" },
 ["ũ"]={ "u","̃" },
 ["Ū"]={ "U","̄" },
 ["ū"]={ "u","̄" },
 ["Ŭ"]={ "U","̆" },
 ["ŭ"]={ "u","̆" },
 ["Ů"]={ "U","̊" },
 ["ů"]={ "u","̊" },
 ["Ű"]={ "U","̋" },
 ["ű"]={ "u","̋" },
 ["Ų"]={ "U","̨" },
 ["ų"]={ "u","̨" },
 ["Ŵ"]={ "W","̂" },
 ["ŵ"]={ "w","̂" },
 ["Ŷ"]={ "Y","̂" },
 ["ŷ"]={ "y","̂" },
 ["Ÿ"]={ "Y","̈" },
 ["Ź"]={ "Z","́" },
 ["ź"]={ "z","́" },
 ["Ż"]={ "Z","̇" },
 ["ż"]={ "z","̇" },
 ["Ž"]={ "Z","̌" },
 ["ž"]={ "z","̌" },
 ["Ơ"]={ "O","̛" },
 ["ơ"]={ "o","̛" },
 ["Ư"]={ "U","̛" },
 ["ư"]={ "u","̛" },
 ["Ǎ"]={ "A","̌" },
 ["ǎ"]={ "a","̌" },
 ["Ǐ"]={ "I","̌" },
 ["ǐ"]={ "i","̌" },
 ["Ǒ"]={ "O","̌" },
 ["ǒ"]={ "o","̌" },
 ["Ǔ"]={ "U","̌" },
 ["ǔ"]={ "u","̌" },
 ["Ǖ"]={ "Ü","̄" },
 ["ǖ"]={ "ü","̄" },
 ["Ǘ"]={ "Ü","́" },
 ["ǘ"]={ "ü","́" },
 ["Ǚ"]={ "Ü","̌" },
 ["ǚ"]={ "ü","̌" },
 ["Ǜ"]={ "Ü","̀" },
 ["ǜ"]={ "ü","̀" },
 ["Ǟ"]={ "Ä","̄" },
 ["ǟ"]={ "ä","̄" },
 ["Ǡ"]={ "Ȧ","̄" },
 ["ǡ"]={ "ȧ","̄" },
 ["Ǣ"]={ "Æ","̄" },
 ["ǣ"]={ "æ","̄" },
 ["Ǧ"]={ "G","̌" },
 ["ǧ"]={ "g","̌" },
 ["Ǩ"]={ "K","̌" },
 ["ǩ"]={ "k","̌" },
 ["Ǫ"]={ "O","̨" },
 ["ǫ"]={ "o","̨" },
 ["Ǭ"]={ "Ǫ","̄" },
 ["ǭ"]={ "ǫ","̄" },
 ["Ǯ"]={ "Ʒ","̌" },
 ["ǯ"]={ "ʒ","̌" },
 ["ǰ"]={ "j","̌" },
 ["Ǵ"]={ "G","́" },
 ["ǵ"]={ "g","́" },
 ["Ǹ"]={ "N","̀" },
 ["ǹ"]={ "n","̀" },
 ["Ǻ"]={ "Å","́" },
 ["ǻ"]={ "å","́" },
 ["Ǽ"]={ "Æ","́" },
 ["ǽ"]={ "æ","́" },
 ["Ǿ"]={ "Ø","́" },
 ["ǿ"]={ "ø","́" },
 ["Ȁ"]={ "A","̏" },
 ["ȁ"]={ "a","̏" },
 ["Ȃ"]={ "A","̑" },
 ["ȃ"]={ "a","̑" },
 ["Ȅ"]={ "E","̏" },
 ["ȅ"]={ "e","̏" },
 ["Ȇ"]={ "E","̑" },
 ["ȇ"]={ "e","̑" },
 ["Ȉ"]={ "I","̏" },
 ["ȉ"]={ "i","̏" },
 ["Ȋ"]={ "I","̑" },
 ["ȋ"]={ "i","̑" },
 ["Ȍ"]={ "O","̏" },
 ["ȍ"]={ "o","̏" },
 ["Ȏ"]={ "O","̑" },
 ["ȏ"]={ "o","̑" },
 ["Ȑ"]={ "R","̏" },
 ["ȑ"]={ "r","̏" },
 ["Ȓ"]={ "R","̑" },
 ["ȓ"]={ "r","̑" },
 ["Ȕ"]={ "U","̏" },
 ["ȕ"]={ "u","̏" },
 ["Ȗ"]={ "U","̑" },
 ["ȗ"]={ "u","̑" },
 ["Ș"]={ "S","̦" },
 ["ș"]={ "s","̦" },
 ["Ț"]={ "T","̦" },
 ["ț"]={ "t","̦" },
 ["Ȟ"]={ "H","̌" },
 ["ȟ"]={ "h","̌" },
 ["Ȧ"]={ "A","̇" },
 ["ȧ"]={ "a","̇" },
 ["Ȩ"]={ "E","̧" },
 ["ȩ"]={ "e","̧" },
 ["Ȫ"]={ "Ö","̄" },
 ["ȫ"]={ "ö","̄" },
 ["Ȭ"]={ "Õ","̄" },
 ["ȭ"]={ "õ","̄" },
 ["Ȯ"]={ "O","̇" },
 ["ȯ"]={ "o","̇" },
 ["Ȱ"]={ "Ȯ","̄" },
 ["ȱ"]={ "ȯ","̄" },
 ["Ȳ"]={ "Y","̄" },
 ["ȳ"]={ "y","̄" },
 ["̈́"]={ "̈","́" },
 ["΅"]={ "¨","́" },
 ["Ά"]={ "Α","́" },
 ["Έ"]={ "Ε","́" },
 ["Ή"]={ "Η","́" },
 ["Ί"]={ "Ι","́" },
 ["Ό"]={ "Ο","́" },
 ["Ύ"]={ "Υ","́" },
 ["Ώ"]={ "Ω","́" },
 ["ΐ"]={ "ϊ","́" },
 ["Ϊ"]={ "Ι","̈" },
 ["Ϋ"]={ "Υ","̈" },
 ["ά"]={ "α","́" },
 ["έ"]={ "ε","́" },
 ["ή"]={ "η","́" },
 ["ί"]={ "ι","́" },
 ["ΰ"]={ "ϋ","́" },
 ["ϊ"]={ "ι","̈" },
 ["ϋ"]={ "υ","̈" },
 ["ό"]={ "ο","́" },
 ["ύ"]={ "υ","́" },
 ["ώ"]={ "ω","́" },
 ["ϓ"]={ "ϒ","́" },
 ["ϔ"]={ "ϒ","̈" },
 ["Ѐ"]={ "Е","̀" },
 ["Ё"]={ "Е","̈" },
 ["Ѓ"]={ "Г","́" },
 ["Ї"]={ "І","̈" },
 ["Ќ"]={ "К","́" },
 ["Ѝ"]={ "И","̀" },
 ["Ў"]={ "У","̆" },
 ["Й"]={ "И","̆" },
 ["й"]={ "и","̆" },
 ["ѐ"]={ "е","̀" },
 ["ё"]={ "е","̈" },
 ["ѓ"]={ "г","́" },
 ["ї"]={ "і","̈" },
 ["ќ"]={ "к","́" },
 ["ѝ"]={ "и","̀" },
 ["ў"]={ "у","̆" },
 ["Ѷ"]={ "Ѵ","̏" },
 ["ѷ"]={ "ѵ","̏" },
 ["Ӂ"]={ "Ж","̆" },
 ["ӂ"]={ "ж","̆" },
 ["Ӑ"]={ "А","̆" },
 ["ӑ"]={ "а","̆" },
 ["Ӓ"]={ "А","̈" },
 ["ӓ"]={ "а","̈" },
 ["Ӗ"]={ "Е","̆" },
 ["ӗ"]={ "е","̆" },
 ["Ӛ"]={ "Ә","̈" },
 ["ӛ"]={ "ә","̈" },
 ["Ӝ"]={ "Ж","̈" },
 ["ӝ"]={ "ж","̈" },
 ["Ӟ"]={ "З","̈" },
 ["ӟ"]={ "з","̈" },
 ["Ӣ"]={ "И","̄" },
 ["ӣ"]={ "и","̄" },
 ["Ӥ"]={ "И","̈" },
 ["ӥ"]={ "и","̈" },
 ["Ӧ"]={ "О","̈" },
 ["ӧ"]={ "о","̈" },
 ["Ӫ"]={ "Ө","̈" },
 ["ӫ"]={ "ө","̈" },
 ["Ӭ"]={ "Э","̈" },
 ["ӭ"]={ "э","̈" },
 ["Ӯ"]={ "У","̄" },
 ["ӯ"]={ "у","̄" },
 ["Ӱ"]={ "У","̈" },
 ["ӱ"]={ "у","̈" },
 ["Ӳ"]={ "У","̋" },
 ["ӳ"]={ "у","̋" },
 ["Ӵ"]={ "Ч","̈" },
 ["ӵ"]={ "ч","̈" },
 ["Ӹ"]={ "Ы","̈" },
 ["ӹ"]={ "ы","̈" },
 ["آ"]={ "ا","ٓ" },
 ["أ"]={ "ا","ٔ" },
 ["ؤ"]={ "و","ٔ" },
 ["إ"]={ "ا","ٕ" },
 ["ئ"]={ "ي","ٔ" },
 ["ۀ"]={ "ە","ٔ" },
 ["ۂ"]={ "ہ","ٔ" },
 ["ۓ"]={ "ے","ٔ" },
 ["ऩ"]={ "न","़" },
 ["ऱ"]={ "र","़" },
 ["ऴ"]={ "ळ","़" },
 ["क़"]={ "क","़" },
 ["ख़"]={ "ख","़" },
 ["ग़"]={ "ग","़" },
 ["ज़"]={ "ज","़" },
 ["ड़"]={ "ड","़" },
 ["ढ़"]={ "ढ","़" },
 ["फ़"]={ "फ","़" },
 ["य़"]={ "य","़" },
 ["ো"]={ "ে","া" },
 ["ৌ"]={ "ে","ৗ" },
 ["ড়"]={ "ড","়" },
 ["ঢ়"]={ "ঢ","়" },
 ["য়"]={ "য","়" },
 ["ਲ਼"]={ "ਲ","਼" },
 ["ਸ਼"]={ "ਸ","਼" },
 ["ਖ਼"]={ "ਖ","਼" },
 ["ਗ਼"]={ "ਗ","਼" },
 ["ਜ਼"]={ "ਜ","਼" },
 ["ਫ਼"]={ "ਫ","਼" },
 ["ୈ"]={ "େ","ୖ" },
 ["ୋ"]={ "େ","ା" },
 ["ୌ"]={ "େ","ୗ" },
 ["ଡ଼"]={ "ଡ","଼" },
 ["ଢ଼"]={ "ଢ","଼" },
 ["ஔ"]={ "ஒ","ௗ" },
 ["ொ"]={ "ெ","ா" },
 ["ோ"]={ "ே","ா" },
 ["ௌ"]={ "ெ","ௗ" },
 ["ై"]={ "ె","ౖ" },
 ["ೀ"]={ "ಿ","ೕ" },
 ["ೇ"]={ "ೆ","ೕ" },
 ["ೈ"]={ "ೆ","ೖ" },
 ["ೊ"]={ "ೆ","ೂ" },
 ["ೋ"]={ "ೊ","ೕ" },
 ["ൊ"]={ "െ","ാ" },
 ["ോ"]={ "േ","ാ" },
 ["ൌ"]={ "െ","ൗ" },
 ["ේ"]={ "ෙ","්" },
 ["ො"]={ "ෙ","ා" },
 ["ෝ"]={ "ො","්" },
 ["ෞ"]={ "ෙ","ෟ" },
 ["གྷ"]={ "ག","ྷ" },
 ["ཌྷ"]={ "ཌ","ྷ" },
 ["དྷ"]={ "ད","ྷ" },
 ["བྷ"]={ "བ","ྷ" },
 ["ཛྷ"]={ "ཛ","ྷ" },
 ["ཀྵ"]={ "ཀ","ྵ" },
 ["ཱི"]={ "ཱ","ི" },
 ["ཱུ"]={ "ཱ","ུ" },
 ["ྲྀ"]={ "ྲ","ྀ" },
 ["ླྀ"]={ "ླ","ྀ" },
 ["ཱྀ"]={ "ཱ","ྀ" },
 ["ྒྷ"]={ "ྒ","ྷ" },
 ["ྜྷ"]={ "ྜ","ྷ" },
 ["ྡྷ"]={ "ྡ","ྷ" },
 ["ྦྷ"]={ "ྦ","ྷ" },
 ["ྫྷ"]={ "ྫ","ྷ" },
 ["ྐྵ"]={ "ྐ","ྵ" },
 ["ဦ"]={ "ဥ","ီ" },
 ["ᬆ"]={ "ᬅ","ᬵ" },
 ["ᬈ"]={ "ᬇ","ᬵ" },
 ["ᬊ"]={ "ᬉ","ᬵ" },
 ["ᬌ"]={ "ᬋ","ᬵ" },
 ["ᬎ"]={ "ᬍ","ᬵ" },
 ["ᬒ"]={ "ᬑ","ᬵ" },
 ["ᬻ"]={ "ᬺ","ᬵ" },
 ["ᬽ"]={ "ᬼ","ᬵ" },
 ["ᭀ"]={ "ᬾ","ᬵ" },
 ["ᭁ"]={ "ᬿ","ᬵ" },
 ["ᭃ"]={ "ᭂ","ᬵ" },
 ["Ḁ"]={ "A","̥" },
 ["ḁ"]={ "a","̥" },
 ["Ḃ"]={ "B","̇" },
 ["ḃ"]={ "b","̇" },
 ["Ḅ"]={ "B","̣" },
 ["ḅ"]={ "b","̣" },
 ["Ḇ"]={ "B","̱" },
 ["ḇ"]={ "b","̱" },
 ["Ḉ"]={ "Ç","́" },
 ["ḉ"]={ "ç","́" },
 ["Ḋ"]={ "D","̇" },
 ["ḋ"]={ "d","̇" },
 ["Ḍ"]={ "D","̣" },
 ["ḍ"]={ "d","̣" },
 ["Ḏ"]={ "D","̱" },
 ["ḏ"]={ "d","̱" },
 ["Ḑ"]={ "D","̧" },
 ["ḑ"]={ "d","̧" },
 ["Ḓ"]={ "D","̭" },
 ["ḓ"]={ "d","̭" },
 ["Ḕ"]={ "Ē","̀" },
 ["ḕ"]={ "ē","̀" },
 ["Ḗ"]={ "Ē","́" },
 ["ḗ"]={ "ē","́" },
 ["Ḙ"]={ "E","̭" },
 ["ḙ"]={ "e","̭" },
 ["Ḛ"]={ "E","̰" },
 ["ḛ"]={ "e","̰" },
 ["Ḝ"]={ "Ȩ","̆" },
 ["ḝ"]={ "ȩ","̆" },
 ["Ḟ"]={ "F","̇" },
 ["ḟ"]={ "f","̇" },
 ["Ḡ"]={ "G","̄" },
 ["ḡ"]={ "g","̄" },
 ["Ḣ"]={ "H","̇" },
 ["ḣ"]={ "h","̇" },
 ["Ḥ"]={ "H","̣" },
 ["ḥ"]={ "h","̣" },
 ["Ḧ"]={ "H","̈" },
 ["ḧ"]={ "h","̈" },
 ["Ḩ"]={ "H","̧" },
 ["ḩ"]={ "h","̧" },
 ["Ḫ"]={ "H","̮" },
 ["ḫ"]={ "h","̮" },
 ["Ḭ"]={ "I","̰" },
 ["ḭ"]={ "i","̰" },
 ["Ḯ"]={ "Ï","́" },
 ["ḯ"]={ "ï","́" },
 ["Ḱ"]={ "K","́" },
 ["ḱ"]={ "k","́" },
 ["Ḳ"]={ "K","̣" },
 ["ḳ"]={ "k","̣" },
 ["Ḵ"]={ "K","̱" },
 ["ḵ"]={ "k","̱" },
 ["Ḷ"]={ "L","̣" },
 ["ḷ"]={ "l","̣" },
 ["Ḹ"]={ "Ḷ","̄" },
 ["ḹ"]={ "ḷ","̄" },
 ["Ḻ"]={ "L","̱" },
 ["ḻ"]={ "l","̱" },
 ["Ḽ"]={ "L","̭" },
 ["ḽ"]={ "l","̭" },
 ["Ḿ"]={ "M","́" },
 ["ḿ"]={ "m","́" },
 ["Ṁ"]={ "M","̇" },
 ["ṁ"]={ "m","̇" },
 ["Ṃ"]={ "M","̣" },
 ["ṃ"]={ "m","̣" },
 ["Ṅ"]={ "N","̇" },
 ["ṅ"]={ "n","̇" },
 ["Ṇ"]={ "N","̣" },
 ["ṇ"]={ "n","̣" },
 ["Ṉ"]={ "N","̱" },
 ["ṉ"]={ "n","̱" },
 ["Ṋ"]={ "N","̭" },
 ["ṋ"]={ "n","̭" },
 ["Ṍ"]={ "Õ","́" },
 ["ṍ"]={ "õ","́" },
 ["Ṏ"]={ "Õ","̈" },
 ["ṏ"]={ "õ","̈" },
 ["Ṑ"]={ "Ō","̀" },
 ["ṑ"]={ "ō","̀" },
 ["Ṓ"]={ "Ō","́" },
 ["ṓ"]={ "ō","́" },
 ["Ṕ"]={ "P","́" },
 ["ṕ"]={ "p","́" },
 ["Ṗ"]={ "P","̇" },
 ["ṗ"]={ "p","̇" },
 ["Ṙ"]={ "R","̇" },
 ["ṙ"]={ "r","̇" },
 ["Ṛ"]={ "R","̣" },
 ["ṛ"]={ "r","̣" },
 ["Ṝ"]={ "Ṛ","̄" },
 ["ṝ"]={ "ṛ","̄" },
 ["Ṟ"]={ "R","̱" },
 ["ṟ"]={ "r","̱" },
 ["Ṡ"]={ "S","̇" },
 ["ṡ"]={ "s","̇" },
 ["Ṣ"]={ "S","̣" },
 ["ṣ"]={ "s","̣" },
 ["Ṥ"]={ "Ś","̇" },
 ["ṥ"]={ "ś","̇" },
 ["Ṧ"]={ "Š","̇" },
 ["ṧ"]={ "š","̇" },
 ["Ṩ"]={ "Ṣ","̇" },
 ["ṩ"]={ "ṣ","̇" },
 ["Ṫ"]={ "T","̇" },
 ["ṫ"]={ "t","̇" },
 ["Ṭ"]={ "T","̣" },
 ["ṭ"]={ "t","̣" },
 ["Ṯ"]={ "T","̱" },
 ["ṯ"]={ "t","̱" },
 ["Ṱ"]={ "T","̭" },
 ["ṱ"]={ "t","̭" },
 ["Ṳ"]={ "U","̤" },
 ["ṳ"]={ "u","̤" },
 ["Ṵ"]={ "U","̰" },
 ["ṵ"]={ "u","̰" },
 ["Ṷ"]={ "U","̭" },
 ["ṷ"]={ "u","̭" },
 ["Ṹ"]={ "Ũ","́" },
 ["ṹ"]={ "ũ","́" },
 ["Ṻ"]={ "Ū","̈" },
 ["ṻ"]={ "ū","̈" },
 ["Ṽ"]={ "V","̃" },
 ["ṽ"]={ "v","̃" },
 ["Ṿ"]={ "V","̣" },
 ["ṿ"]={ "v","̣" },
 ["Ẁ"]={ "W","̀" },
 ["ẁ"]={ "w","̀" },
 ["Ẃ"]={ "W","́" },
 ["ẃ"]={ "w","́" },
 ["Ẅ"]={ "W","̈" },
 ["ẅ"]={ "w","̈" },
 ["Ẇ"]={ "W","̇" },
 ["ẇ"]={ "w","̇" },
 ["Ẉ"]={ "W","̣" },
 ["ẉ"]={ "w","̣" },
 ["Ẋ"]={ "X","̇" },
 ["ẋ"]={ "x","̇" },
 ["Ẍ"]={ "X","̈" },
 ["ẍ"]={ "x","̈" },
 ["Ẏ"]={ "Y","̇" },
 ["ẏ"]={ "y","̇" },
 ["Ẑ"]={ "Z","̂" },
 ["ẑ"]={ "z","̂" },
 ["Ẓ"]={ "Z","̣" },
 ["ẓ"]={ "z","̣" },
 ["Ẕ"]={ "Z","̱" },
 ["ẕ"]={ "z","̱" },
 ["ẖ"]={ "h","̱" },
 ["ẗ"]={ "t","̈" },
 ["ẘ"]={ "w","̊" },
 ["ẙ"]={ "y","̊" },
 ["ẛ"]={ "ſ","̇" },
 ["Ạ"]={ "A","̣" },
 ["ạ"]={ "a","̣" },
 ["Ả"]={ "A","̉" },
 ["ả"]={ "a","̉" },
 ["Ấ"]={ "Â","́" },
 ["ấ"]={ "â","́" },
 ["Ầ"]={ "Â","̀" },
 ["ầ"]={ "â","̀" },
 ["Ẩ"]={ "Â","̉" },
 ["ẩ"]={ "â","̉" },
 ["Ẫ"]={ "Â","̃" },
 ["ẫ"]={ "â","̃" },
 ["Ậ"]={ "Ạ","̂" },
 ["ậ"]={ "ạ","̂" },
 ["Ắ"]={ "Ă","́" },
 ["ắ"]={ "ă","́" },
 ["Ằ"]={ "Ă","̀" },
 ["ằ"]={ "ă","̀" },
 ["Ẳ"]={ "Ă","̉" },
 ["ẳ"]={ "ă","̉" },
 ["Ẵ"]={ "Ă","̃" },
 ["ẵ"]={ "ă","̃" },
 ["Ặ"]={ "Ạ","̆" },
 ["ặ"]={ "ạ","̆" },
 ["Ẹ"]={ "E","̣" },
 ["ẹ"]={ "e","̣" },
 ["Ẻ"]={ "E","̉" },
 ["ẻ"]={ "e","̉" },
 ["Ẽ"]={ "E","̃" },
 ["ẽ"]={ "e","̃" },
 ["Ế"]={ "Ê","́" },
 ["ế"]={ "ê","́" },
 ["Ề"]={ "Ê","̀" },
 ["ề"]={ "ê","̀" },
 ["Ể"]={ "Ê","̉" },
 ["ể"]={ "ê","̉" },
 ["Ễ"]={ "Ê","̃" },
 ["ễ"]={ "ê","̃" },
 ["Ệ"]={ "Ẹ","̂" },
 ["ệ"]={ "ẹ","̂" },
 ["Ỉ"]={ "I","̉" },
 ["ỉ"]={ "i","̉" },
 ["Ị"]={ "I","̣" },
 ["ị"]={ "i","̣" },
 ["Ọ"]={ "O","̣" },
 ["ọ"]={ "o","̣" },
 ["Ỏ"]={ "O","̉" },
 ["ỏ"]={ "o","̉" },
 ["Ố"]={ "Ô","́" },
 ["ố"]={ "ô","́" },
 ["Ồ"]={ "Ô","̀" },
 ["ồ"]={ "ô","̀" },
 ["Ổ"]={ "Ô","̉" },
 ["ổ"]={ "ô","̉" },
 ["Ỗ"]={ "Ô","̃" },
 ["ỗ"]={ "ô","̃" },
 ["Ộ"]={ "Ọ","̂" },
 ["ộ"]={ "ọ","̂" },
 ["Ớ"]={ "Ơ","́" },
 ["ớ"]={ "ơ","́" },
 ["Ờ"]={ "Ơ","̀" },
 ["ờ"]={ "ơ","̀" },
 ["Ở"]={ "Ơ","̉" },
 ["ở"]={ "ơ","̉" },
 ["Ỡ"]={ "Ơ","̃" },
 ["ỡ"]={ "ơ","̃" },
 ["Ợ"]={ "Ơ","̣" },
 ["ợ"]={ "ơ","̣" },
 ["Ụ"]={ "U","̣" },
 ["ụ"]={ "u","̣" },
 ["Ủ"]={ "U","̉" },
 ["ủ"]={ "u","̉" },
 ["Ứ"]={ "Ư","́" },
 ["ứ"]={ "ư","́" },
 ["Ừ"]={ "Ư","̀" },
 ["ừ"]={ "ư","̀" },
 ["Ử"]={ "Ư","̉" },
 ["ử"]={ "ư","̉" },
 ["Ữ"]={ "Ư","̃" },
 ["ữ"]={ "ư","̃" },
 ["Ự"]={ "Ư","̣" },
 ["ự"]={ "ư","̣" },
 ["Ỳ"]={ "Y","̀" },
 ["ỳ"]={ "y","̀" },
 ["Ỵ"]={ "Y","̣" },
 ["ỵ"]={ "y","̣" },
 ["Ỷ"]={ "Y","̉" },
 ["ỷ"]={ "y","̉" },
 ["Ỹ"]={ "Y","̃" },
 ["ỹ"]={ "y","̃" },
 ["ἀ"]={ "α","̓" },
 ["ἁ"]={ "α","̔" },
 ["ἂ"]={ "ἀ","̀" },
 ["ἃ"]={ "ἁ","̀" },
 ["ἄ"]={ "ἀ","́" },
 ["ἅ"]={ "ἁ","́" },
 ["ἆ"]={ "ἀ","͂" },
 ["ἇ"]={ "ἁ","͂" },
 ["Ἀ"]={ "Α","̓" },
 ["Ἁ"]={ "Α","̔" },
 ["Ἂ"]={ "Ἀ","̀" },
 ["Ἃ"]={ "Ἁ","̀" },
 ["Ἄ"]={ "Ἀ","́" },
 ["Ἅ"]={ "Ἁ","́" },
 ["Ἆ"]={ "Ἀ","͂" },
 ["Ἇ"]={ "Ἁ","͂" },
 ["ἐ"]={ "ε","̓" },
 ["ἑ"]={ "ε","̔" },
 ["ἒ"]={ "ἐ","̀" },
 ["ἓ"]={ "ἑ","̀" },
 ["ἔ"]={ "ἐ","́" },
 ["ἕ"]={ "ἑ","́" },
 ["Ἐ"]={ "Ε","̓" },
 ["Ἑ"]={ "Ε","̔" },
 ["Ἒ"]={ "Ἐ","̀" },
 ["Ἓ"]={ "Ἑ","̀" },
 ["Ἔ"]={ "Ἐ","́" },
 ["Ἕ"]={ "Ἑ","́" },
 ["ἠ"]={ "η","̓" },
 ["ἡ"]={ "η","̔" },
 ["ἢ"]={ "ἠ","̀" },
 ["ἣ"]={ "ἡ","̀" },
 ["ἤ"]={ "ἠ","́" },
 ["ἥ"]={ "ἡ","́" },
 ["ἦ"]={ "ἠ","͂" },
 ["ἧ"]={ "ἡ","͂" },
 ["Ἠ"]={ "Η","̓" },
 ["Ἡ"]={ "Η","̔" },
 ["Ἢ"]={ "Ἠ","̀" },
 ["Ἣ"]={ "Ἡ","̀" },
 ["Ἤ"]={ "Ἠ","́" },
 ["Ἥ"]={ "Ἡ","́" },
 ["Ἦ"]={ "Ἠ","͂" },
 ["Ἧ"]={ "Ἡ","͂" },
 ["ἰ"]={ "ι","̓" },
 ["ἱ"]={ "ι","̔" },
 ["ἲ"]={ "ἰ","̀" },
 ["ἳ"]={ "ἱ","̀" },
 ["ἴ"]={ "ἰ","́" },
 ["ἵ"]={ "ἱ","́" },
 ["ἶ"]={ "ἰ","͂" },
 ["ἷ"]={ "ἱ","͂" },
 ["Ἰ"]={ "Ι","̓" },
 ["Ἱ"]={ "Ι","̔" },
 ["Ἲ"]={ "Ἰ","̀" },
 ["Ἳ"]={ "Ἱ","̀" },
 ["Ἴ"]={ "Ἰ","́" },
 ["Ἵ"]={ "Ἱ","́" },
 ["Ἶ"]={ "Ἰ","͂" },
 ["Ἷ"]={ "Ἱ","͂" },
 ["ὀ"]={ "ο","̓" },
 ["ὁ"]={ "ο","̔" },
 ["ὂ"]={ "ὀ","̀" },
 ["ὃ"]={ "ὁ","̀" },
 ["ὄ"]={ "ὀ","́" },
 ["ὅ"]={ "ὁ","́" },
 ["Ὀ"]={ "Ο","̓" },
 ["Ὁ"]={ "Ο","̔" },
 ["Ὂ"]={ "Ὀ","̀" },
 ["Ὃ"]={ "Ὁ","̀" },
 ["Ὄ"]={ "Ὀ","́" },
 ["Ὅ"]={ "Ὁ","́" },
 ["ὐ"]={ "υ","̓" },
 ["ὑ"]={ "υ","̔" },
 ["ὒ"]={ "ὐ","̀" },
 ["ὓ"]={ "ὑ","̀" },
 ["ὔ"]={ "ὐ","́" },
 ["ὕ"]={ "ὑ","́" },
 ["ὖ"]={ "ὐ","͂" },
 ["ὗ"]={ "ὑ","͂" },
 ["Ὑ"]={ "Υ","̔" },
 ["Ὓ"]={ "Ὑ","̀" },
 ["Ὕ"]={ "Ὑ","́" },
 ["Ὗ"]={ "Ὑ","͂" },
 ["ὠ"]={ "ω","̓" },
 ["ὡ"]={ "ω","̔" },
 ["ὢ"]={ "ὠ","̀" },
 ["ὣ"]={ "ὡ","̀" },
 ["ὤ"]={ "ὠ","́" },
 ["ὥ"]={ "ὡ","́" },
 ["ὦ"]={ "ὠ","͂" },
 ["ὧ"]={ "ὡ","͂" },
 ["Ὠ"]={ "Ω","̓" },
 ["Ὡ"]={ "Ω","̔" },
 ["Ὢ"]={ "Ὠ","̀" },
 ["Ὣ"]={ "Ὡ","̀" },
 ["Ὤ"]={ "Ὠ","́" },
 ["Ὥ"]={ "Ὡ","́" },
 ["Ὦ"]={ "Ὠ","͂" },
 ["Ὧ"]={ "Ὡ","͂" },
 ["ὰ"]={ "α","̀" },
 ["ὲ"]={ "ε","̀" },
 ["ὴ"]={ "η","̀" },
 ["ὶ"]={ "ι","̀" },
 ["ὸ"]={ "ο","̀" },
 ["ὺ"]={ "υ","̀" },
 ["ὼ"]={ "ω","̀" },
 ["ᾀ"]={ "ἀ","ͅ" },
 ["ᾁ"]={ "ἁ","ͅ" },
 ["ᾂ"]={ "ἂ","ͅ" },
 ["ᾃ"]={ "ἃ","ͅ" },
 ["ᾄ"]={ "ἄ","ͅ" },
 ["ᾅ"]={ "ἅ","ͅ" },
 ["ᾆ"]={ "ἆ","ͅ" },
 ["ᾇ"]={ "ἇ","ͅ" },
 ["ᾈ"]={ "Ἀ","ͅ" },
 ["ᾉ"]={ "Ἁ","ͅ" },
 ["ᾊ"]={ "Ἂ","ͅ" },
 ["ᾋ"]={ "Ἃ","ͅ" },
 ["ᾌ"]={ "Ἄ","ͅ" },
 ["ᾍ"]={ "Ἅ","ͅ" },
 ["ᾎ"]={ "Ἆ","ͅ" },
 ["ᾏ"]={ "Ἇ","ͅ" },
 ["ᾐ"]={ "ἠ","ͅ" },
 ["ᾑ"]={ "ἡ","ͅ" },
 ["ᾒ"]={ "ἢ","ͅ" },
 ["ᾓ"]={ "ἣ","ͅ" },
 ["ᾔ"]={ "ἤ","ͅ" },
 ["ᾕ"]={ "ἥ","ͅ" },
 ["ᾖ"]={ "ἦ","ͅ" },
 ["ᾗ"]={ "ἧ","ͅ" },
 ["ᾘ"]={ "Ἠ","ͅ" },
 ["ᾙ"]={ "Ἡ","ͅ" },
 ["ᾚ"]={ "Ἢ","ͅ" },
 ["ᾛ"]={ "Ἣ","ͅ" },
 ["ᾜ"]={ "Ἤ","ͅ" },
 ["ᾝ"]={ "Ἥ","ͅ" },
 ["ᾞ"]={ "Ἦ","ͅ" },
 ["ᾟ"]={ "Ἧ","ͅ" },
 ["ᾠ"]={ "ὠ","ͅ" },
 ["ᾡ"]={ "ὡ","ͅ" },
 ["ᾢ"]={ "ὢ","ͅ" },
 ["ᾣ"]={ "ὣ","ͅ" },
 ["ᾤ"]={ "ὤ","ͅ" },
 ["ᾥ"]={ "ὥ","ͅ" },
 ["ᾦ"]={ "ὦ","ͅ" },
 ["ᾧ"]={ "ὧ","ͅ" },
 ["ᾨ"]={ "Ὠ","ͅ" },
 ["ᾩ"]={ "Ὡ","ͅ" },
 ["ᾪ"]={ "Ὢ","ͅ" },
 ["ᾫ"]={ "Ὣ","ͅ" },
 ["ᾬ"]={ "Ὤ","ͅ" },
 ["ᾭ"]={ "Ὥ","ͅ" },
 ["ᾮ"]={ "Ὦ","ͅ" },
 ["ᾯ"]={ "Ὧ","ͅ" },
 ["ᾰ"]={ "α","̆" },
 ["ᾱ"]={ "α","̄" },
 ["ᾲ"]={ "ὰ","ͅ" },
 ["ᾳ"]={ "α","ͅ" },
 ["ᾴ"]={ "ά","ͅ" },
 ["ᾶ"]={ "α","͂" },
 ["ᾷ"]={ "ᾶ","ͅ" },
 ["Ᾰ"]={ "Α","̆" },
 ["Ᾱ"]={ "Α","̄" },
 ["Ὰ"]={ "Α","̀" },
 ["ᾼ"]={ "Α","ͅ" },
 ["῁"]={ "¨","͂" },
 ["ῂ"]={ "ὴ","ͅ" },
 ["ῃ"]={ "η","ͅ" },
 ["ῄ"]={ "ή","ͅ" },
 ["ῆ"]={ "η","͂" },
 ["ῇ"]={ "ῆ","ͅ" },
 ["Ὲ"]={ "Ε","̀" },
 ["Ὴ"]={ "Η","̀" },
 ["ῌ"]={ "Η","ͅ" },
 ["῍"]={ "᾿","̀" },
 ["῎"]={ "᾿","́" },
 ["῏"]={ "᾿","͂" },
 ["ῐ"]={ "ι","̆" },
 ["ῑ"]={ "ι","̄" },
 ["ῒ"]={ "ϊ","̀" },
 ["ῖ"]={ "ι","͂" },
 ["ῗ"]={ "ϊ","͂" },
 ["Ῐ"]={ "Ι","̆" },
 ["Ῑ"]={ "Ι","̄" },
 ["Ὶ"]={ "Ι","̀" },
 ["῝"]={ "῾","̀" },
 ["῞"]={ "῾","́" },
 ["῟"]={ "῾","͂" },
 ["ῠ"]={ "υ","̆" },
 ["ῡ"]={ "υ","̄" },
 ["ῢ"]={ "ϋ","̀" },
 ["ῤ"]={ "ρ","̓" },
 ["ῥ"]={ "ρ","̔" },
 ["ῦ"]={ "υ","͂" },
 ["ῧ"]={ "ϋ","͂" },
 ["Ῠ"]={ "Υ","̆" },
 ["Ῡ"]={ "Υ","̄" },
 ["Ὺ"]={ "Υ","̀" },
 ["Ῥ"]={ "Ρ","̔" },
 ["῭"]={ "¨","̀" },
 ["ῲ"]={ "ὼ","ͅ" },
 ["ῳ"]={ "ω","ͅ" },
 ["ῴ"]={ "ώ","ͅ" },
 ["ῶ"]={ "ω","͂" },
 ["ῷ"]={ "ῶ","ͅ" },
 ["Ὸ"]={ "Ο","̀" },
 ["Ὼ"]={ "Ω","̀" },
 ["ῼ"]={ "Ω","ͅ" },
 ["↚"]={ "←","̸" },
 ["↛"]={ "→","̸" },
 ["↮"]={ "↔","̸" },
 ["⇍"]={ "⇐","̸" },
 ["⇎"]={ "⇔","̸" },
 ["⇏"]={ "⇒","̸" },
 ["∄"]={ "∃","̸" },
 ["∉"]={ "∈","̸" },
 ["∌"]={ "∋","̸" },
 ["∤"]={ "∣","̸" },
 ["∦"]={ "∥","̸" },
 ["≁"]={ "∼","̸" },
 ["≄"]={ "≃","̸" },
 ["≇"]={ "≅","̸" },
 ["≉"]={ "≈","̸" },
 ["≠"]={ "=","̸" },
 ["≢"]={ "≡","̸" },
 ["≭"]={ "≍","̸" },
 ["≮"]={ "<","̸" },
 ["≯"]={ ">","̸" },
 ["≰"]={ "≤","̸" },
 ["≱"]={ "≥","̸" },
 ["≴"]={ "≲","̸" },
 ["≵"]={ "≳","̸" },
 ["≸"]={ "≶","̸" },
 ["≹"]={ "≷","̸" },
 ["⊀"]={ "≺","̸" },
 ["⊁"]={ "≻","̸" },
 ["⊄"]={ "⊂","̸" },
 ["⊅"]={ "⊃","̸" },
 ["⊈"]={ "⊆","̸" },
 ["⊉"]={ "⊇","̸" },
 ["⊬"]={ "⊢","̸" },
 ["⊭"]={ "⊨","̸" },
 ["⊮"]={ "⊩","̸" },
 ["⊯"]={ "⊫","̸" },
 ["⋠"]={ "≼","̸" },
 ["⋡"]={ "≽","̸" },
 ["⋢"]={ "⊑","̸" },
 ["⋣"]={ "⊒","̸" },
 ["⋪"]={ "⊲","̸" },
 ["⋫"]={ "⊳","̸" },
 ["⋬"]={ "⊴","̸" },
 ["⋭"]={ "⊵","̸" },
 ["⫝̸"]={ "⫝","̸" },
 ["が"]={ "か","゙" },
 ["ぎ"]={ "き","゙" },
 ["ぐ"]={ "く","゙" },
 ["げ"]={ "け","゙" },
 ["ご"]={ "こ","゙" },
 ["ざ"]={ "さ","゙" },
 ["じ"]={ "し","゙" },
 ["ず"]={ "す","゙" },
 ["ぜ"]={ "せ","゙" },
 ["ぞ"]={ "そ","゙" },
 ["だ"]={ "た","゙" },
 ["ぢ"]={ "ち","゙" },
 ["づ"]={ "つ","゙" },
 ["で"]={ "て","゙" },
 ["ど"]={ "と","゙" },
 ["ば"]={ "は","゙" },
 ["ぱ"]={ "は","゚" },
 ["び"]={ "ひ","゙" },
 ["ぴ"]={ "ひ","゚" },
 ["ぶ"]={ "ふ","゙" },
 ["ぷ"]={ "ふ","゚" },
 ["べ"]={ "へ","゙" },
 ["ぺ"]={ "へ","゚" },
 ["ぼ"]={ "ほ","゙" },
 ["ぽ"]={ "ほ","゚" },
 ["ゔ"]={ "う","゙" },
 ["ゞ"]={ "ゝ","゙" },
 ["ガ"]={ "カ","゙" },
 ["ギ"]={ "キ","゙" },
 ["グ"]={ "ク","゙" },
 ["ゲ"]={ "ケ","゙" },
 ["ゴ"]={ "コ","゙" },
 ["ザ"]={ "サ","゙" },
 ["ジ"]={ "シ","゙" },
 ["ズ"]={ "ス","゙" },
 ["ゼ"]={ "セ","゙" },
 ["ゾ"]={ "ソ","゙" },
 ["ダ"]={ "タ","゙" },
 ["ヂ"]={ "チ","゙" },
 ["ヅ"]={ "ツ","゙" },
 ["デ"]={ "テ","゙" },
 ["ド"]={ "ト","゙" },
 ["バ"]={ "ハ","゙" },
 ["パ"]={ "ハ","゚" },
 ["ビ"]={ "ヒ","゙" },
 ["ピ"]={ "ヒ","゚" },
 ["ブ"]={ "フ","゙" },
 ["プ"]={ "フ","゚" },
 ["ベ"]={ "ヘ","゙" },
 ["ペ"]={ "ヘ","゚" },
 ["ボ"]={ "ホ","゙" },
 ["ポ"]={ "ホ","゚" },
 ["ヴ"]={ "ウ","゙" },
 ["ヷ"]={ "ワ","゙" },
 ["ヸ"]={ "ヰ","゙" },
 ["ヹ"]={ "ヱ","゙" },
 ["ヺ"]={ "ヲ","゙" },
 ["ヾ"]={ "ヽ","゙" },
 ["יִ"]={ "י","ִ" },
 ["ײַ"]={ "ײ","ַ" },
 ["שׁ"]={ "ש","ׁ" },
 ["שׂ"]={ "ש","ׂ" },
 ["שּׁ"]={ "שּ","ׁ" },
 ["שּׂ"]={ "שּ","ׂ" },
 ["אַ"]={ "א","ַ" },
 ["אָ"]={ "א","ָ" },
 ["אּ"]={ "א","ּ" },
 ["בּ"]={ "ב","ּ" },
 ["גּ"]={ "ג","ּ" },
 ["דּ"]={ "ד","ּ" },
 ["הּ"]={ "ה","ּ" },
 ["וּ"]={ "ו","ּ" },
 ["זּ"]={ "ז","ּ" },
 ["טּ"]={ "ט","ּ" },
 ["יּ"]={ "י","ּ" },
 ["ךּ"]={ "ך","ּ" },
 ["כּ"]={ "כ","ּ" },
 ["לּ"]={ "ל","ּ" },
 ["מּ"]={ "מ","ּ" },
 ["נּ"]={ "נ","ּ" },
 ["סּ"]={ "ס","ּ" },
 ["ףּ"]={ "ף","ּ" },
 ["פּ"]={ "פ","ּ" },
 ["צּ"]={ "צ","ּ" },
 ["קּ"]={ "ק","ּ" },
 ["רּ"]={ "ר","ּ" },
 ["שּ"]={ "ש","ּ" },
 ["תּ"]={ "ת","ּ" },
 ["וֹ"]={ "ו","ֹ" },
 ["בֿ"]={ "ב","ֿ" },
 ["כֿ"]={ "כ","ֿ" },
 ["פֿ"]={ "פ","ֿ" },
 ["𑂚"]={ "𑂙","𑂺" },
 ["𑂜"]={ "𑂛","𑂺" },
 ["𑂫"]={ "𑂥","𑂺" },
 ["𑄮"]={ "𑄱","𑄧" },
 ["𑄯"]={ "𑄲","𑄧" },
 ["𑍋"]={ "𑍇","𑌾" },
 ["𑍌"]={ "𑍇","𑍗" },
 ["𑒻"]={ "𑒹","𑒺" },
 ["𑒼"]={ "𑒹","𑒰" },
 ["𑒾"]={ "𑒹","𑒽" },
 ["𑖺"]={ "𑖸","𑖯" },
 ["𑖻"]={ "𑖹","𑖯" },
 ["𝅗𝅥"]={ "𝅗","𝅥" },
 ["𝅘𝅥"]={ "𝅘","𝅥" },
 ["𝅘𝅥𝅮"]={ "𝅘𝅥","𝅮" },
 ["𝅘𝅥𝅯"]={ "𝅘𝅥","𝅯" },
 ["𝅘𝅥𝅰"]={ "𝅘𝅥","𝅰" },
 ["𝅘𝅥𝅱"]={ "𝅘𝅥","𝅱" },
 ["𝅘𝅥𝅲"]={ "𝅘𝅥","𝅲" },
 ["𝆹𝅥"]={ "𝆹","𝅥" },
 ["𝆺𝅥"]={ "𝆺","𝅥" },
 ["𝆹𝅥𝅮"]={ "𝆹𝅥","𝅮" },
 ["𝆺𝅥𝅮"]={ "𝆺𝅥","𝅮" },
 ["𝆹𝅥𝅯"]={ "𝆹𝅥","𝅯" },
 ["𝆺𝅥𝅯"]={ "𝆺𝅥","𝅯" },
   },
  },
 },
 ["name"]="collapse",
 ["prepend"]=true,
 ["type"]="ligature",
}

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-lig”] ---


do  --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-gbn” 34e4543a02f6fbc8c2ade896cb6dc7df] ---

if not modules then modules={} end modules ['luatex-fonts-gbn']={
 version=1.001,
 comment="companion to luatex-*.tex",
 author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
 copyright="PRAGMA ADE / ConTeXt Development Team",
 license="see context related readme files"
}
if context then
 os.exit()
end
local next=next
local fonts=fonts
local nodes=nodes
local nuts=nodes.nuts 
local traverseid=nuts.traverseid
local flushnode=nuts.flushnode
local glyph_code=nodes.nodecodes.glyph
local disc_code=nodes.nodecodes.disc
local tonode=nuts.tonode
local tonut=nuts.tonut
local getfont=nuts.getfont
local getchar=nuts.getchar
local getid=nuts.getid
local getboth=nuts.getboth
local getprev=nuts.getprev
local getnext=nuts.getnext
local getdisc=nuts.getdisc
local setchar=nuts.setchar
local setlink=nuts.setlink
local setprev=nuts.setprev
local n_ligaturing=node.ligaturing
local n_kerning=node.kerning
local d_ligaturing=nuts.ligaturing
local d_kerning=nuts.kerning
local basemodepass=true
local function l_warning() logs.report("fonts","don't call 'node.ligaturing' directly") l_warning=nil end
local function k_warning() logs.report("fonts","don't call 'node.kerning' directly") k_warning=nil end
function node.ligaturing(...)
 if basemodepass and l_warning then
  l_warning()
 end
 return n_ligaturing(...)
end
function node.kerning(...)
 if basemodepass and k_warning then
  k_warning()
 end
 return n_kerning(...)
end
function nuts.ligaturing(...)
 if basemodepass and l_warning then
  l_warning()
 end
 return d_ligaturing(...)
end
function nuts.kerning(...)
 if basemodepass and k_warning then
  k_warning()
 end
 return d_kerning(...)
end
function nodes.handlers.setbasemodepass(v)
 basemodepass=v
end
local function nodepass(head,groupcode,size,packtype,direction)
 local fontdata=fonts.hashes.identifiers
 if fontdata then
  local usedfonts={}
  local basefonts={}
  local prevfont=nil
  local basefont=nil
  local variants=nil
  local redundant=nil
  local nofused=0
  for n in traverseid(glyph_code,head) do
   local font=getfont(n)
   if font~=prevfont then
    if basefont then
     basefont[2]=getprev(n)
    end
    prevfont=font
    local used=usedfonts[font]
    if not used then
     local tfmdata=fontdata[font] 
     if tfmdata then
      local shared=tfmdata.shared 
      if shared then
       local processors=shared.processes
       if processors and #processors>0 then
        usedfonts[font]=processors
        nofused=nofused+1
       elseif basemodepass then
        basefont={ n,nil }
        basefonts[#basefonts+1]=basefont
       end
      end
      local resources=tfmdata.resources
      variants=resources and resources.variants
      variants=variants and next(variants) and variants or false
     end
    else
     local tfmdata=fontdata[prevfont]
     if tfmdata then
      local resources=tfmdata.resources
      variants=resources and resources.variants
      variants=variants and next(variants) and variants or false
     end
    end
   end
   if variants then
    local char=getchar(n)
    if (char>=0xFE00 and char<=0xFE0F) or (char>=0xE0100 and char<=0xE01EF) then
     local hash=variants[char]
     if hash then
      local p=getprev(n)
      if p and getid(p)==glyph_code then
       local variant=hash[getchar(p)]
       if variant then
        setchar(p,variant)
       end
      end
     end
     if not redundant then
      redundant={ n }
     else
      redundant[#redundant+1]=n
     end
    end
   end
  end
  local nofbasefonts=#basefonts
  if redundant then
   for i=1,#redundant do
    local r=redundant[i]
    local p,n=getboth(r)
    if r==head then
     head=n
     setprev(n)
    else
     setlink(p,n)
    end
    if nofbasefonts>0 then
     for i=1,nofbasefonts do
      local bi=basefonts[i]
      if r==bi[1] then
       bi[1]=n
      end
      if r==bi[2] then
       bi[2]=n
      end
     end
    end
    flushnode(r)
   end
  end
  for d in traverseid(disc_code,head) do
   local _,_,r=getdisc(d)
   if r then
    for n in traverseid(glyph_code,r) do
     local font=getfont(n)
     if font~=prevfont then
      prevfont=font
      local used=usedfonts[font]
      if not used then
       local tfmdata=fontdata[font] 
       if tfmdata then
        local shared=tfmdata.shared 
        if shared then
         local processors=shared.processes
         if processors and #processors>0 then
          usedfonts[font]=processors
          nofused=nofused+1
         end
        end
       end
      end
     end
    end
   end
  end
  if next(usedfonts) then
   for font,processors in next,usedfonts do
    for i=1,#processors do
     head=processors[i](head,font,0,direction,nofused) or head
    end
   end
  end
  if basemodepass and nofbasefonts>0 then
   for i=1,nofbasefonts do
    local range=basefonts[i]
    local start=range[1]
    local stop=range[2]
    if start then
     local front=head==start
     local prev,next
     if stop then
      next=getnext(stop)
      start,stop=d_ligaturing(start,stop)
      start,stop=d_kerning(start,stop)
     else
      prev=getprev(start)
      start=d_ligaturing(start)
      start=d_kerning(start)
     end
     if prev then
      setlink(prev,start)
     end
     if next then
      setlink(stop,next)
     end
     if front and head~=start then
      head=start
     end
    end
   end
  end
 end
 return head
end
local function basepass(head)
 if basemodepass then
  head=d_ligaturing(head)
  head=d_kerning(head)
 end
 return head
end
local protectpass=node.direct.protectglyphs or node.direct.protect_glyphs
local injectpass=nodes.injections.handler
function nodes.handlers.nodepass(head,...)
 if head then
  return tonode(nodepass(tonut(head),...))
 end
end
function nodes.handlers.basepass(head)
 if head then
  return tonode(basepass(tonut(head)))
 end
end
function nodes.handlers.injectpass(head)
 if head then
  return tonode(injectpass(tonut(head)))
 end
end
function nodes.handlers.protectpass(head)
 if head then
  protectpass(tonut(head))
  return head
 end
end
function nodes.simple_font_handler(head,groupcode,size,packtype,direction)
 if head then
  head=tonut(head)
  head=nodepass(head,groupcode,size,packtype,direction)
  head=injectpass(head)
  if not basemodepass then
   head=basepass(head)
  end
  protectpass(head)
  head=tonode(head)
 end
 return head
end

end --- [luaotfload, fontloader-2022-02-24.lua scope for “fonts-gbn”] ---


--- vim:ft=lua:sw=2:ts=8:et:tw=79