summaryrefslogtreecommitdiff
path: root/specs/fsproto.xml
blob: 05dfc9134828cf76ce216f07f9a4435aa4c7563f (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
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>


<book id="fsproto">

<bookinfo>
   <title>The X Font Service Protocol</title>
   <subtitle>X Consortium Standard</subtitle>
   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
   <releaseinfo>Version 2.0</releaseinfo>
   <authorgroup>
      <author>
         <firstname>Jim</firstname><surname>Fulton</surname>
         <affiliation><orgname>Network Computing Devices, Inc.</orgname></affiliation>
      </author>
   </authorgroup>
   <edition>Revised May 2, 1994</edition>
   <copyright><year>1991</year><holder>Network Computing Devices, Inc.</holder></copyright>

<legalnotice>
<para>
Permission to use, copy, modify, distribute, and sell this
documentation for any purpose is hereby granted without fee,
provided that the above copyright notice and this permission
notice appear in all copies.  Network Computing Devices, Inc.
makes no representations about the suitability for any purpose
of the information in this document.  This documentation is
provided "as is" without express or implied warranty.
</para>
</legalnotice>

<legalnotice>
<para role="multiLicensing">Copyright © 1994 X Consortium</para>
<para>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</para>
<para>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</para>
<para>
THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</para>
<para>
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
</para>
</legalnotice>
</bookinfo>

<chapter id='Introduction'>
<title>Introduction</title>
<para>
The management of fonts in large, heterogeneous environments is one of the
hardest aspects of using the X Window System
<footnote><para>
<emphasis remap='I'>X Window System</emphasis>
is a trademark of The Open Group.
</para></footnote>
.  Multiple formats and the lack of
a consistent mechanism for exporting font data to all displays on a network
prevent the transparent use of applications across different display platforms.
The X Font Service protocol is designed to address this and other issues, with
specific emphasis on the needs of the core X protocol.  Upward-compatible
changes (typically in the form of new requests) are expected as consensus is
reached on new features (particularly outline font support).
</para>
<para>
Currently, most X displays use network file protocols such as NFS and TFTP to
obtain raw font data which they parse directly.  Since a common binary format
for this data doesn't exist, displays must be able to interpret a variety of
formats if they are to be used with different application hosts.  This leads to
wasted code and data space and a loss of interoperability as displays are used
in unforeseen environments.
</para>
<para>
By moving the interpretation of font data out of the X server into a separate
service on the network, these problems can be greatly reduced.  In addition,
new technologies, such as dynamically generating bitmaps from scaled or outline
fonts, can be provided to all displays transparently.  For horizontal text,
caching techniques and increased processor power can potentially make
rasterization more efficient on large, centralized hosts than on individual
displays.
</para>
<para>
Each font server provides sets of fonts that may be listed and queried for
header, property, glyph extents, and bitmap information.  This data is
transmitted over the network using a binary format (with variations to support
different bit- and byte-orders) designed to minimize the amount of processing
required by the display.  Since the font server, rather than the display, is
responsible for parsing the raw font data, new formats can be used by all
displays by modifying a single font server.
</para>
<para>
From the user's point of view, font servers are simply a new type of name in
the X font path.  Network name services allow descriptive names (such as
DEPARTMENT-FONTS or APPLICATION-FONTS) to be translated into proper network
addresses.  X displays send requests to and read replies from the font server
rather than reading directly from files.  Since the X Font Service protocol is
designed to allow subsets of the font data to be requested, displays may easily
implement a variety of strategies for fine-grained demand-loading of glyphs.
</para>
</chapter>

<chapter id='Architectural_Model'>
<title>Architectural Model</title>
<!-- .XS -->
<!-- (SN Architectural Model -->
<!-- .XE -->
<para>
<!-- .LP -->
In this document, the words "client" and "server" refer to the consumer and
provider of a font, respectively, unless otherwise indicated.  It is important
to note that in this context, the X server is also a font client.
</para>
<para>
The X Font Service protocol does not require any changes to the core X protocol
or to any applications.  To the user, font servers are simply additional types
of font path elements.  As such, X servers may connect to multiple font
servers, as shown in Figure 2.1.  Although the font protocol is geared towards
the X Window System, it may be also used by other consumers of font data (such
as printer drivers).
</para>

<literallayout class="monospaced">
 ┌────────┐              ┌───────────────┐
 │   X1   ├──────────────┤               │
 │ Server │              │  Font Server  │
 └────────┘      ┌───────┤      1        │
                 │       └───────────────┘
 ┌────────┐      │
 │   X2   ├──────┘       ┌───────────────┐
 │ Server ├──────────────┤               │
 └────────┘              │  Font Server  │
                 ┌───────┤      2        │
┌─────────┐      │       └───────────────┘
│  other  │      │
│ clients ├──────┘
└─────────┘
</literallayout>

<para>
Figure 2.1:  Connecting to a Font Server
</para>

<para>
<!-- .LP  -->
Clients communicate with the font server using the request/reply/event model
over any mutually-understood virtual stream connection (such as TCP/IP, DECnet,
<footnote><para>
DECnet is a trademark of Digital Equipment Corporation.
</para></footnote>
etc.).  Font servers are responsible for providing data in the bit and byte
orders requested by the client.  The set of requests and events provided in the
first version of the X Font Service protocol is limited to supporting the needs
of the bitmap-oriented core X Window System protocol.  Extensions are expected
as new needs evolve.
</para>
<para>
<!-- .LP -->
A font server reads raw font data from a variety of sources (possibly
including other font servers) and converts it into a common format that is
transmitted to the client using the protocol described in Section 4.  New font
formats are handled by adding new converters to a font server, as shown in
Figure 2.2.
</para>

<literallayout class="monospaced">
                ┌────────────┐
                │   client   │
                │ (X server) │
                └─────┬──────┘
                      │
                   network
                      │
┌─────────────────────┴──────────────────────┐
│                                            │
│                font server 1               │
│                                            │
├─────┬─────┬─────┬─────┬────┬─────┬───┬─────┤
│ bdf │ snf │ pcf │ atm │ f3 │ dwf │ │ │ ... │
└─────┴─────┴─────┴─────┴────┴─────┴─│─┴─────┘
                                     │
                                  network
                                     │
                               ┌─────┴────┐
                               │   font   │
                               │ server 2 │
                               └──────────┘
</literallayout>

<para>
Figure 2.2:  Where Font Data Comes From
</para>

<para>
The server may choose to provide named sets of fonts called "catalogues."
Clients may specify which of the sets should be used in listing or opening a
font.
</para>

<para>
An event mechanism similar to that used in the X protocol is provided for
asynchronous notification of clients by the server.
</para>

<para>
<!-- .LP -->
Clients may provide authorization data for the server to be used in determining
(according to the server's licensing policy) whether or not access should be
granted to particular fonts.  This is particularly useful for clients whose
authorization changes over time (such as an X server that can verify the
identity of the user).
</para>
<para>
<!-- .LP -->
Implementations that wish to provide additional requests or events may use the
extension mechanism.  Adding to the core font service protocol (with the
accompanying change in the major or minor version numbers) is reserved to the X
Consortium.
</para>
</chapter>

<chapter id='Font_Server_Naming'>
<title>Font Server Naming</title>
<!-- .XS -->
<!-- (SN Font Server Naming -->
<!-- .XE -->
<para>
Font clients that expose font server names to the user are encouraged to
provide ways of naming font servers symbolically (e.g. DEPARTMENT-FONTS).
However, for environments that lack appropriate name services
transport-specific names are necessary.  Since these names do occur in the
protocol, clients and servers should support at least the applicable formats
described below.  Formats for additional transports may be registered with the
X Consortium.
</para>

<section id='TCPIP_Names'>
<title>TCP/IP Names</title>
<!-- .XS -->
<!-- (SN TCP/IP Names -->
<!-- .XE -->
<para>
The following syntax should be used for TCP/IP names:
</para>

<literallayout class="monospaced">
    &lt;TCP name&gt;  ::=  "tcp/" &lt;hostname&gt;":" &lt;ipportnumber&gt; ["/" &lt;cataloguelist&gt;]
</literallayout>

<para>
where &lt;hostname&gt; is either symbolic (such as expo.lcs.mit.edu) or numeric
decimal (such as 18.30.0.212).  The &lt;ipportnumber&gt; is the port on
which the
font server is listening for connections.  The &lt;cataloguelist&gt; string at
the end is optional and specifies a plus-separated list of catalogues
that may be requested.  For example:
</para>
<literallayout class="monospaced">
     tcp/expo.lcs.mit.edu:8012/available+special
     tcp/18.30.0.212:7890
</literallayout>
</section>

<section id='DECnet_Names'>
<title>DECnet Names</title>
<!-- .XS -->
<!-- (SN DECnet Names -->
<!-- .XE -->
<para>
<!-- .LP -->
The following syntax should be used for DECnet names:
</para>
<literallayout class="monospaced">
    &lt;DECnet name&gt;  ::=  "decnet/" &lt;nodename&gt; "::font$" &lt;objname&gt;
               ["/" &lt;cataloguelist&gt;]
</literallayout>
<para>
where &lt;nodename&gt; is either symbolic (such as SRVNOD) or the
numeric decimal
form of the DECnet address (such as 44.70).  The &lt;objname&gt; is normal,
case-insensitive DECnet object name.  The &lt;cataloguelist&gt; string
at the end is
optional and specifies a plus-separated list of catalogues that may be
requested.  For example:
</para>

<literallayout class="monospaced">
     DECNET/SRVNOD::FONT$DEFAULT/AVAILABLE
     decnet/44.70::font$other
</literallayout>
</section>
</chapter>

<chapter id='Protocol'>
<title>Protocol</title>
<!-- .XS -->
<!-- (SN Protocol -->
<!-- .XE -->
<para>
<!-- .LP -->
The protocol described below uses the request/reply/error model and is
specified using the same conventions outlined in
<olink targetdoc='x11protocol' targetptr='Syntactic_Conventions'>Section 2
of the core X Window System protocol</olink>
<xref linkend="References:x11proto"/>:
</para>
<itemizedlist>
  <listitem>
    <para>
<!-- .IP \(bu 5 -->
Data type names are spelled in upper case with no word separators,
as in:  FONTID
    </para>
  </listitem>
  <listitem>
    <para>
<!-- .IP \(bu 5 -->
Alternate values are capitalized with no word separators,
as in:  MaxWidth
    </para>
  </listitem>
  <listitem>
    <para>
<!-- .IP \(bu 5 -->
Structure element declarations are in lower case with hyphens
as word separators, as in:  byte-order-msb
    </para>
    <note>
      <para>
Structure element names are referred to in
upper case (e.g. BYTE-ORDER-MSB) when used in
descriptions to set them off from the surrounding
text.  When this document is typeset they will be
printed in lower case in a distinct font.
      </para>
    </note>
  </listitem>
  <listitem>
    <para>
Type declarations have the form "name: type",
as in:  CARD8: 8-bit byte
    </para>
  </listitem>
  <listitem>
    <para>
Comma-separated lists of alternate values are enclosed in
braces, as in:  { Min, MaxWidth, Max }
    </para>
  </listitem>
  <listitem>
    <para>
Comma-separated lists of structure elements are enclosed in
brackets, as in:  [ byte1: CARD8, byte2: CARD8 ]
    </para>
  </listitem>
</itemizedlist>

<para>
<!-- .LP -->
A type with a prefix "LISTof" represents a counted list of
elements of that type, as in:  LISTofCARD8
</para>

<section id='Data_Types'>
<title>Data Types</title>
<!-- .XS -->
<!-- (SN Data Types -->
<!-- .XE -->
<para>
The following data types are used in the core X Font Server protocol:
</para>

<literallayout class="monospaced">
ACCESSCONTEXT:     ID
</literallayout>
<blockquote>
<para>
This value is specified in the CreateAC request as the identifier
to be used when referring to a particular AccessContext resource
within the server.  These resources are used by the server to
store client-specified authorization information.  This
information may be used by the server to determine whether or not
the client should be granted access to particular font data.
</para>
<para>
<!-- .sp -->
In order to preserve the integrity of font licensing being performed by
the font server, care must be taken by a client to properly represent the
identity of the true user of the font.  Some font clients will in fact
be servers (for example, X servers) requesting fonts for their own clients.
Other font clients may be doing work on behalf of a number of different
users over time (for example, print spoolers).
</para>
<para>
<!-- .sp -->
<function>AccessContexts </function>
must be created (with
<function>CreateAC ) </function>
and switched among (with
<function>SetAuthorization )</function>
to represent all of these "font users" properly.
    </para>
</blockquote>

<literallayout class="monospaced">
ALTERNATESERVER:  [ name:  STRING8,
                    subset:  BOOL ]
</literallayout>

<blockquote>
    <para>
This structure specifies the NAME, encoded in ISO 8859-1 according
to Section 3, of another font server that may be useful as a
substitute for this font server.  The SUBSET field indicates
whether or not the alternate server is likely to only contain a
subset of the fonts available from this font server.  This
information is returned during the initial connection setup and
may be used by the client to find a backup server in case of
failure.
    </para>
</blockquote>

<literallayout class="monospaced">
AUTH:  [ name:  STRING8,
         data:  LISTofBYTE ]
</literallayout>

<blockquote>
<para>
This structure specifies the name of an authorization protocol and
initial data for that protocol.  It is used in the authorization
negotiation in the initial connection setup and in the CreateAC
request.
</para>
</blockquote>

<literallayout class="monospaced">
BITMAPFORMAT:
</literallayout>

<literallayout class="monospaced">
   CARD32 containing the following fields defined by the
   sets of values given further below
   [
     byte-order-msb:      1 bit,
     bit-order-msb:       1 bit,
     image-rect:          2 bits { Min,
                          MaxWidth,
                          Max },
     zero-pad:            4 bits,
     scanline-pad:        2 bits { ScanlinePad8,
                          ScanlinePad16,
                          ScanlinePad32,
                          ScanlinePad64 },
     zero-pad:            2 bits,
     scanline-unit:       2 bits { ScanlineUnit8,
                          ScanlineUnit16,
                          ScanlineUnit32,
                          ScanlineUnit64 },
     zero-pad:            2 bits,
     zero-pad:            16 bits,
   ]
</literallayout>

<blockquote>
<para>
This structure specifies how glyph images are transmitted in
response to
<function>QueryXBitmaps8 </function>
and
<function>QueryXBitmaps16 </function>
requests.
</para>
<para>
<!-- .sp -->
If the BYTE-ORDER-MSB bit (1 &lt;&lt; 0) is set, the Most Significant
Byte of each scanline unit is returned first.  Otherwise, the
Least Significant Byte is returned first.
</para>
<para>
<!-- .sp -->
If the BIT-ORDER-MSB bit (1 &lt;&lt; 1) is set, the left-most bit in
each glyph scanline unit is stored in the Most Significant Bit of
each transmitted scanline unit.  Otherwise, the left-most bit is
stored in the Least Significant Bit.
</para>
<para>
<!-- .sp -->
The IMAGE-RECT field specifies a rectangle of pixels within the
glyph image.  It contains one of the following alternate values:
</para>

<literallayout class="monospaced">
     ImageRectMin          (0 &lt;&lt; 2)
     ImageRectMaxWidth     (1 &lt;&lt; 2)
     ImageRectMax          (2 &lt;&lt; 2)
</literallayout>
<para>
For a glyph with extents XCHARINFO in a font with header information
XFONTINFO, the IMAGE-RECT values have the following meanings:
</para>
<para>
<function>ImageRectMin -</function>
This refers to the minimal bounding rectangle
surrounding the inked pixels in the glyph.  This is the
most compact representation.  The edges of the rectangle
are:
</para>
<literallayout class="monospaced">
         left:     XCHARINFO.LBEARING
         right:    XCHARINFO.RBEARING
         top:      XCHARINFO.ASCENT
         bottom:   XCHARINFO.DESCENT
</literallayout>
<para>

<function>ImageRectMaxWidth - </function>
This refers to the scanlines between the
glyph's ascent and descent, padded on the left to the minimum
left-bearing (or 0, whichever is less) and on the right to
the maximum right-bearing (or logical-width, whichever is
greater).  All glyph images share a common horizontal
origin.  This is a combination of ImageRectMax in the
horizontal direction and ImageRectMin in the vertical
direction.  The edges of the rectangle are:
</para>

<literallayout class="monospaced">
left:         min (XFONTINFO.MIN-BOUNDS.LBEARING, 0)
right:        max (XFONTINFO.MAX-BOUNDS.RBEARING,
                   XFONTINFO.MAX-BOUNDS.WIDTH)
top:               XCHARINFO.ASCENT
bottom:            XCHARINFO.DESCENT
</literallayout>

<para>
ImageRectMax - This refers to all scanlines, from the maximum
ascent (or the font ascent, whichever is greater) to the
maximum descent (or the font descent, whichever is greater),
padded to the same horizontal extents as MaxWidth.
All glyph images have the same sized bitmap and share a
common origin.  This is the least compact representation,
but may be the easiest or most efficient (particularly for
character cell fonts) for some clients to use.  The edges of
the rectangle are:
</para>

<literallayout class="monospaced">
left:         min (XFONTINFO.MIN-BOUNDS.LBEARING, 0)
right:        max (XFONTINFO.MAX-BOUNDS.RBEARING,
                   XFONTINFO.MAX-BOUNDS.WIDTH)
top:          max (XFONTINFO.FONT-ASCENT,
                   XFONTINFO.MAX-BOUNDS.ASCENT)
bottom:       max (XFONTINFO.FONT-DESCENT,
                   XFONTINFO.MAX-BOUNDS.DESCENT)
</literallayout>
<para>
The SCANLINE-PAD field specifies the number of bits (8, 16, 32,
or 64) to which each glyph scanline is padded before transmitting.
It contains one of the following alternate values:
</para>
<literallayout class="monospaced">
     ScanlinePad8          (0 &lt;&lt; 8)
     ScanlinePad16         (1 &lt;&lt; 8)
     ScanlinePad32         (2 &lt;&lt; 8)
     ScanlinePad64         (3 &lt;&lt; 8)
</literallayout>
<para>
The SCANLINE-UNIT field specifies the number of bits (8, 16, 32,
or 64) that should be treated as a unit for swapping.  This value
must be less than or equal to the number of bits specified by the
SCANLINE-PAD.  It contains one of the following alternate values:
</para>

<literallayout class="monospaced">
     ScanlineUnit8          (0 &lt;&lt; 12)
     ScanlineUnit16         (1 &lt;&lt; 12)
     ScanlineUnit32         (2 &lt;&lt; 12)
     ScanlineUnit64         (3 &lt;&lt; 12)
</literallayout>
<para>
BITMAPFORMATs are byte-swapped as CARD32s.  All unspecified bits
must be zero.
</para>
<para>
Use of an invalid BITMAPFORMAT causes a Format error to
be returned.
</para>
</blockquote>
<para>
BITMAPFORMATMASK:     CARD32 mask
</para>
<blockquote>
<para>
This is a mask of bits representing the fields in a BITMAPFORMAT:
</para>
</blockquote>
<literallayout class="monospaced">
     ByteOrderMask          (1 &lt;&lt; 0)
     BitOrderMask           (1 &lt;&lt; 1)
     ImageRectMask          (1 &lt;&lt; 2)
     ScanlinePadMask        (1 &lt;&lt; 3)
     ScanlineUnitMask       (1 &lt;&lt; 4)
</literallayout>
<para>
Unspecified bits are required to be zero or else a Format error
is returned.
</para>
<para>
BOOL:  CARD8
</para>
<blockquote>
<para>
This is a boolean value containing one of the following alternate
values:
</para>

<literallayout class="monospaced">
     False              0
     True               1
</literallayout>
</blockquote>

<para>
BYTE:  8-bit value
</para>

<blockquote>
<para>
This is an unsigned byte of data whose encoding
is determined by the context in which it is used.
</para>
</blockquote>

<para>
CARD8:  8-bit unsigned integer
</para>

<para>
CARD16:  16-bit unsigned integer
</para>

<para>
CARD32:  32-bit unsigned integer
</para>

<blockquote>
<para>
These are unsigned numbers.  The latter two are byte-swapped when
the server and client have different byte orders.
</para>
</blockquote>

<para>
CHAR2B:  [ byte1, byte2:  CARD8 ]
</para>
<blockquote>
<para>
This structure specifies an individual character code within
either a 2-dimensional matrix (using BYTE1 and BYTE2 as the row
and column indices, respectively) or a vector (using BYTE1 and
BYTE2 as most- and least-significant bytes, respectively).  This
data type is treated as a pair of 8-bit values and is never
byte-swapped.  Therefore, the client should always transmit BYTE1
first.
</para>
</blockquote>

<para>
EVENTMASK:  CARD32 mask
</para>

<blockquote>
<para>
This is a mask of bits indicating which of an extension's (or the
core's) maskable events the client would like to receive.  Each
bit indicates one or more events, and a bit value of one indicates
interest in a corresponding set of events.  The following bits are
defined for event masks specified for the core protocol (i.e. an
EXTENSION-OPCODE of zero in
<function>SetEventMask </function>
and
<function>GetEventMask </function>
requests):
</para>

<literallayout class="monospaced">
     CatalogueListChangeMask          (1 &lt;&lt; 0)
     FontListChangeMask               (1 &lt;&lt; 1)
</literallayout>

<para>
If
<function>CatalogueListChangeMask </function>
is set, client is interested in
receiving
<function>CatalogueListNotify </function>
events.  If
<function>FontListChangeMask </function>
is set, the client is interested in
receiving
<function>FontListNotify </function>
events.
</para>
<para>
<!-- .sp -->
Extensions that provide additional events may define their own
event masks.  These event masks have their own scope and may use
the same bit values as the core or other extensions.
<!-- .sp -->
All unused bits must be set to zero.  In
<function>SetEventMask </function>
requests, if
any bits are set that are not defined for the extension (or core)
for which this EVENTMASK is intended (according to the EXTENSION-
OPCODE given in the
<function>SetEventMask </function>
request), an
<function>EventMask </function>
error is generated.
<!-- .sp -->
This value is swapped as a CARD32.
    </para>
</blockquote>

<para>
FONTID:     ID
</para>

<blockquote>
<para>
This is specified by the client in the request
<function>OpenBitmapFont </function>
as the identifier to be used when referring to a particular open
font.
</para>
</blockquote>

<para>
ID:  CARD32
</para>

<blockquote>
<para>
This is a 32-bit value in which the top 3 bits must be clear, and
at least 1 other bit must be set (yielding a range of 1 through
2^29-1).  It is specified by the client to represent objects in
the server.  Identifiers are scoped according to their type are
private to the client; thus, the same identifier may be used for
both a FONTID and an ACCESSCONTEXT as well as by multiple clients.
</para>
<para>
An ID of zero is referred to as None.
</para>
</blockquote>

<para>
INT8:  8-bit signed integer
</para>

<para>
INT16:  16-bit signed integer
</para>

<para>
INT32:  32-bit signed integer
</para>

<blockquote>
<para>
These are signed numbers.  The latter two are byte-swapped when
the client and server have different byte orders.
</para>
</blockquote>

<literallayout class="monospaced">
OFFSET32:      [  position:     CARD32,
                  length:       CARD32 ]
</literallayout>

<blockquote>
    <para>
This structure indicates a position and length within a block of
data.
    </para>
</blockquote>

<literallayout class="monospaced">
PROPINFO:     [ offsets:          LISTofPROPOFFSET,
                data:             LISTofBYTE ]
</literallayout>

<blockquote>
    <para>
This structure describes the list of properties provided by a
font.  Strings for all of the properties names and values are
stored within the data block and are located using a table of
offsets and lengths.
    </para>
    <para>
This structure is padded to 32-bit alignment.
    </para>
</blockquote>

<literallayout class="monospaced">
PROPOFFSET:     [ name:          OFFSET32,
                 value:          OFFSET32,
                 type:           CARD8,
                 zero-pad3:      BYTE, BYTE, BYTE ]
</literallayout>

<blockquote>
    <para>
This structure specifies the position, length, and type of
of data for a property.
    </para>
    <para>
The NAME field specifies the position and length (which must be
greater than zero) of the property name relative to the beginning
of the PROPINFO.DATA block for this font.  The interpretation of
the position and length of the VALUE field is determined by the
TYPE field, which contains one of the following alternate values:
    </para>
</blockquote>

<literallayout class="monospaced">
     String          0
     Unsigned        1
     Signed          2
</literallayout>

<blockquote>
    <para>
which have the following meanings:
    </para>
    <blockquote>
      <para>
This property contains a counted string of bytes.  The
data is stored in the PROPINFO.DATA block beginning at
relative byte VALUE.POSITION (beginning with zero), extending
for VALUE.LENGTH (at least zero) bytes.
      </para>
    </blockquote>
    <para>
This property contains a unsigned, 32-bit number stored
as a CARD32 in VALUE.POSITION (VALUE.LENGTH is zero).
    </para>
    <blockquote>
      <para>
This property contains a signed, 32-bit number stored as
an INT32 in VALUE.POSITION (VALUE.LENGTH is zero).
This structure is zero-padded to 32-bit alignment.
      </para>
    </blockquote>
</blockquote>

<para>
RANGE:     [ min-char, max-char:     CHAR2B ]
</para>

<blockquote>
  <para>
This structure specifies a range of character codes.  A single
character is represented by MIN-CHAR equals MAX-CHAR.  If the
linear interpretation of MAX-CHAR is less than that of MIN-CHAR,
or if MIN-CHAR is less than the font's
XFONTINFO.CHAR-RANGE.MIN-CHAR, or if MAX-CHAR is greater than the
font's XFONTINFO.CHAR-RANGE.MAX-CHAR, the range is invalid.
  </para>
</blockquote>

<literallayout class="monospaced">
RESOLUTION:     [ x-resolution:          CARD16,
                  y-resolution:          CARD16,
                  decipoint-size:        CARD16 ]
</literallayout>

<blockquote>
  <para>
This structure specifies resolution and point size to be used in
resolving partially-specified scaled font names.  The X-RESOLUTION
and Y-RESOLUTION are measured in pixels-per-inch and must be
greater than zero.  The DECIPOINT-SIZE is the preferred font
size, measured in tenths of a point, and must be greater than zero.
  </para>
</blockquote>

<para>
STRING8:          LISTofCARD8
</para>

<blockquote>
  <para>
This is a counted list of 1-byte character codes, typically
encoded in ISO 8859-1.  A character code "c" is equivalent to a
CHAR2B structure whose BYTE1 is zero and whose BYTE2 is "c".
  </para>
</blockquote>

<para>
TIMESTAMP:     CARD32
</para>

<blockquote>
  <para>
This is the number of milliseconds that have passed since a server-
dependent origin.  It is provided in errors and events and is
permitted to wrap.
  </para>
</blockquote>

<para>
XCHARINFO:     [ lbearing, rbearing:     INT16,
                 width:                  INT16,
                 ascent, descent:        INT16,
                 attributes:             CARD16 ]
</para>

<blockquote>
  <para>
This structure specifies the ink extents and horizontal escapement
(also known as the set- or logical width) of an individual
character.  The first five values represent directed distances in
a coordinate system whose origin is aligned with the lower-left
edge of the left-most pixel of the glyph baseline (i.e. the
baseline falls between two pixels as shown in Figure 3-1 of the
<citetitle>Bitmap Distribution Format 2.1</citetitle> Consortium standard
<xref linkend="References:bdf-spec"/>).
  </para>
<!-- .sp -->
  <para>
The LBEARING field specifies the directed distance measured to the
right from the origin to the left edge of the left-most inked
pixel in the glyph.
<!-- .sp -->
  </para>
  <para>
The RBEARING field specifies the directed distance (measured to
the right) from the origin to the right edge of the right-most
inked pixel in the glyph.
<!-- .sp -->
  </para>
  <para>
The WIDTH field specifies the directed distance (measured to the
right) from the origin to the position where the next character
should appear (called the "escapement point").  This distance
includes any whitespace used for intercharacter padding and is
also referred to as the "logical width" or "horizontal
escapement."
<!-- .sp -->
  </para>
  <para>
The ASCENT field specifies the directed distance (measured up)
from the baseline to the top edge of the top-most inked pixel
in the glyph.
<!-- .sp -->
  </para>
  <para>
The DESCENT field specifies the directed distance (measured
down) from the baseline to the bottom edge of the bottom-most
inked pixel.
<!-- .sp -->
  </para>
  <para>
The ATTRIBUTES field specifies glyph-specific information that
is passed through the application.  If this value is not being
used, it should be zero.
  </para>
  <para>
The ink bounding box of a glyph is defined to be the smallest
rectangle that encloses all of the inked pixels.  This box has
a width of RBEARING - LBEARING pixels and a height of
ASCENT + DESCENT pixels.
  </para>
</blockquote>

<literallayout class="monospaced">
XFONTINFO:     [ flags:               CARD32,
                 drawing-direction:   { LeftToRight, RightToLeft }
                 char-range:          RANGE,
                 default-char:        CHAR2B,
                 min-bounds:          XCHARINFO,
                 max-bounds:          XCHARINFO,
                 font-ascent:         INT16,
                 font-descent:        INT16,
                 properties:          PROPINFO ]
</literallayout>

<blockquote>
  <para>
This structure specifies attributes related to the font as a
whole.
  </para>
  <para>
The FLAGS field is a bit mask containing zero or more of the
following boolean values (unspecified bits must be zero):
  </para>

<literallayout class="monospaced">
     AllCharactersExist     (1 &lt;&lt; 0)
     InkInside              (1 &lt;&lt; 1)
     HorizontalOverlap      (1 &lt;&lt; 2)
</literallayout>

    <para>
which have the following meanings:
    </para>
    <para>
AllCharactersExist
    </para>

<blockquote>
    <para>
If this bit is set, all of the characters
in the range given by CHAR-RANGE have glyphs encoded in
the font.  If this bit is clear, some of the characters
may not have encoded glyphs.
    </para>
</blockquote>

<para>
InkInside
</para>
<blockquote>
    <para>
If this bit is set, the inked pixels of each glyph
fall within the rectangle described by the font's ascent,
descent, origin, and the glyph's escapement point.  If
this bit is clear, there may be glyphs whose ink extends
outside this rectangle.
    </para>
</blockquote>
<para>
HorizontalOverlap
</para>
<blockquote>
    <para>
If this bit is set, the two ink bounding
boxes (smallest rectangle enclosing the inked pixels) of
some pairs of glyphs in the font may overlap when displayed
side-by-side (i.e. the second character is imaged at the
escapement point of the first) on a common baseline.  If
this bit is clear, there are no pairs of glyphs whose ink
bounding boxes overlap.
    </para>
</blockquote>
<para>
The DRAWING-DIRECTION field contains a hint indicating whether
most of the character metrics have a positive (or "LeftToRight")
logical width or a negative ("RightToLeft") logical width.  It
contains the following alternate values:
</para>
<literallayout class="monospaced">
         LeftToRight          0
         RightToLeft          1
</literallayout>
<para>
The CHAR-RANGE.MIN-CHAR and CHAR-RANGE.MAX-CHAR fields specify the
first and last character codes that have glyphs encoded in this font.
All fonts must have at least one encoded glyph (in which case the
MIN-CHAR and MAX-CHAR are equal), but are not required to have glyphs
encoded at all positions between the first and last characters.
</para>
<para>
The DEFAULT-CHAR field specifies the character code of the glyph
that the client should substitute for unencoded characters.  Requests
for extents or bitmaps for an unencoded character generate zero-filled
metrics and a zero-length glyph bitmap, respectively.
</para>
<para>
The MIN-BOUNDS and MAX-BOUNDS fields contain the minimum and maximum
values of each of the extents field of all encoded characters in the
font (i.e. non-existent characters are ignored).
</para>
<para>
The FONT-ASCENT and FONT-DESCENT fields specify the font designer's
logical height of the font, above and below the baseline,
respectively.  The sum of the two values is often used as the
vertical line spacing of the font.  Individual glyphs are permitted
to have ascents and descents that are greater than these values.
</para>
<para>
The PROPERTIES field contains the property data associated with
this font.
</para>
<para>
This structure is padded to 32-bit alignment.
</para>
</blockquote>
</section>

<section id='Requests'>
<title>Requests</title>
<!-- .XS -->
<!-- (SN Requests -->
<!-- .XE -->
<para>
<!-- .LP -->
This section describes the requests that may be sent by the client and the
replies or errors that are generated in response.  Versions of the protocol
with the same major version are required to be upward-compatible.
</para>
<para>
<!-- .LP -->
Every request on a given connection is implicitly assigned a sequence number,
starting with 1, that is used in replies, error, and events.  Servers are
required to generate replies and errors in the order in which the corresponding
requests are received.  Servers are permitted to add or remove fonts to the
list visible to the client between any two requests, but requests must be
processed atomically.  Each request packet is at least 4 bytes long and
contains the following fields:
</para>
<!-- .RS -->
<literallayout class="monospaced">
     major-opcode:               CARD8
     minor-opcode:               CARD8
     length:                    CARD16
</literallayout>
<para>
<!-- .RE -->
The MAJOR-OPCODE specifies which core request or extension package this packet
represents.  If the MAJOR-OPCODE corresponds to a core request, the
MINOR-OPCODE contains 8 bits of request-specific data.  Otherwise, the
MINOR-OPCODE specifies which extension request this packet represents.  The
LENGTH field specifies the number of 4-byte units contained within the packet
and must be at least one.  If this field contains a value greater than one it
is followed by (LENGTH - 1) * 4 bytes of request-specific data.  Unless
otherwise specified, unused bytes are not required to be zero.
</para>
<para>
<!-- .LP -->
If a request packet contains too little or too much data, the server returns
a Length error.  If the server runs out of internal resources (such as
memory) while processing a request, it returns an Alloc error.  If a server is
deficient (and therefore non-compliant) and is unable to process a request, it
may return an Implementation error.  If a client uses an extension request
without previously having issued a
<function>QueryExtension </function>
request for that extension, the server responds with a
<function>Request </function>
error.  If the server encounters a request
with an unknown MAJOR-OPCODE or MINOR-OPCODE, it responds with a
<function>Request </function>
error.
At most one error is generated per request.  If more than one error condition
is encountered in processing a requests, the choice of which error is returned
is server-dependent.
</para>
<para>
<!-- .LP -->
Core requests have MAJOR-OPCODE values between 0 and 127, inclusive.  Extension
requests have MAJOR-OPCODE values between 128 and 255, inclusive, that are
assigned by by the server.  All MINOR-OPCODE values in extension requests are
between 0 and 255, inclusive.
</para>
<para>
<!-- .LP -->
Each reply is at least 8 bytes long and contains the following fields:
</para>
<!-- .RS -->
<literallayout class="monospaced">
     type:                 CARD8 value of 0
     data-or-unused:       CARD8
     sequence-number:      CARD16
     length:               CARD32
</literallayout>
<para>
<!-- .RE -->
The TYPE field has a value of zero.  The DATA-OR-UNUSED field may be used to
encode one byte of reply-specific data (see Section 5.2 on request encoding).
The least-significant 16 bits of the sequence number of the request that
generated the reply are stored in the SEQUENCE-NUMBER field.  The LENGTH field
specifies the number of 4-byte units in this reply packet, including the fields
described above, and must be at least two.  If LENGTH is greater than two, the
fields described above are followed by (LENGTH - 2) * 4 bytes of additional
data.
</para>
<para>
<!-- .LP -->
Requests that have replies are described using the following syntax:
</para>
<!-- .RS -->
<literallayout class="monospaced">
     RequestName
         <emphasis remap='I'>arg1</emphasis>:  type1
         <emphasis remap='I'>arg2</emphasis>:  type2
         ...
         <emphasis remap='I'>argN</emphasis>:  typeN
           ▶
        <emphasis remap='I'>result1</emphasis>:  type1
         <emphasis remap='I'>result2</emphasis>:  type2
         ...
         <emphasis remap='I'>resultM</emphasis>:  typeM

     Errors:  <emphasis remap='I'>kind1</emphasis>, <emphasis remap='I'>kind2</emphasis> ..., <emphasis remap='I'>kindK</emphasis>

     Description
</literallayout>
<para>
<!-- .RE -->
If a request does not generate a reply, the "▶" and result lines are
omitted.  If a request may generate multiple replies, the "▶" is replaced by
a "▶+".  In the authorization data exchanges in the initial connection setup
and the CreateAC request, "◀" indicates data sent by the client in response
to data sent by the server.
</para>
<para>
<!-- .LP -->
The protocol begins with the establishment of a connection over a
mutually-understood virtual stream:
</para>

<literallayout class="monospaced">

  open connection
     byte-order:                         BYTE
     client-major-protocol-version:      CARD16
     client-minor-protocol-version:      CARD16
     authorization-protocols:            LISTofAUTH
</literallayout>
<para>
The initial byte of the connection specifies the BYTE-ORDER in
which subsequent 16-bit and 32-bit numeric values are to be
transmitted.  The octal value 102 (ASCII uppercase `B')
indicates that the most-significant byte is to be transmitted
first; the octal value 154 (ASCII lowercase `l') indicates
that the least-significant byte is to be transmitted first.
If any other value is encountered the server closes the
connection without any response.
</para>

<blockquote>
  <para>
The CLIENT-MAJOR-PROTOCOL-VERSION and
CLIENT-MINOR-PROTOCOL-VERSION specify which version of the
font service protocol the client would like to use.  If the
client can support multiple versions, the highest version
should be given.  This version of the protocol has a
major version of 2 and a minor version of 0.
  </para>
  <para>
The AUTHORIZATION-PROTOCOLS contains a list of protocol names and
optional initial data for which the client can provide
information.  The server may use this to determine which
protocol to use or as part of the initial exchange of
authorization data.
  </para>
<literallayout class="monospaced">
▶
status:                         { Success, Continue,
                                  Busy, Denied }
server-major-protocol-version:  CARD16
server-minor-protocol-version:  CARD16
alternate-servers-hint:         LISTofALTERNATESERVER
authorization-index:            CARD8
authorization-data:             LISTofBYTE
</literallayout>
  <para>
<!-- .RE -->
The SERVER-MAJOR-PROTOCOL-VERSION and
SERVER-MINOR-PROTOCOL-VERSION specify the version of the font
service protocol that the server expects from the client.  If
the server supports the version specified by the client, this
version number should be returned.  If the client has
requested a higher version than is supported by the server,
the server's highest version should be returned.  Otherwise,
if the client has requested a lower version than is supported
by the server, the server's lowest version should be returned.
It is the client's responsibility to decide whether or not it
can match this version of the protocol.
  </para>
  <para>
The ALTERNATE-SERVERS-HINT is a list of other font servers
that may have related sets of fonts (determined by means
outside this protocol, typically by the system administrator).
Clients may choose to contact these font servers if the
connection is rejected or lost.
  </para>
  <para>
The STATUS field indicates whether the server accepted,
rejected, or would like more information about the connection.
It has one of the following alternate values:
  </para>
<literallayout class="monospaced">

          Success          0
          Continue         1
          Busy             2
          Denied           3
</literallayout>
  <para>
<!-- .RE -->
If STATUS is Denied, the server has rejected the client's
authorization information.  If STATUS is Busy, the server has
simply decided that it cannot provide fonts to this client at
this time (it may be able to at a later time).  In both cases,
AUTHORIZATION-INDEX is set to zero, no authorization-data is
returned, and the server closes the connection after sending
the data described so far.
  </para>
  <para>
Otherwise the AUTHORIZATION-INDEX is set to the index
(beginning with 1) into the AUTHORIZATION-PROTOCOLS list of
the protocol that the server will use for this connection.  If
the server does not want to use any of the given protocols,
this value is set to zero.  The AUTHORIZATION-DATA field is
used to send back authorization protocol-dependent data to the
client (such as a challenge, authentication of the server,
etc.).
  </para>
</blockquote>

<para>
<!-- .LP -->
If STATUS is Success, the following section of protocol is
omitted.  Otherwise, if STATUS is Continue, the server expects
more authorization data from the client (i.e. the connection
setup is not finished, so no requests or events may be sent):
</para>

<literallayout class="monospaced">
◀
more-authorization-data:   STRING8
▶
status:                    { Success, Continue,
                           Busy, Denied }
more-authorization-data:   LISTofBYTE
</literallayout>

<!-- .RE -->
<para>
The values in STATUS have the same meanings as described
above.  This section of protocol is repeated until the server
either accepts (sets STATUS to Success) or rejects (sets
STATUS to Denied or Busy) the connection.
</para>
<para>
<!-- .LP -->
Once the connection has been accepted and STATUS is Success,
an implicit AccessContext is created for the authorization
data and the protocol continues with the following data sent
from the server:
</para>
<!-- .RS -->
<literallayout class="monospaced">
▶
remaining-length:           CARD32
maximum-request-length:     CARD16
release-number:             CARD32
vendor:                     STRING8
</literallayout>
<para>
The REMAINING-LENGTH specifies the length in 4-byte units of
the remaining data to be transmitted to the client.  The
MAXIMUM-REQUEST-LENGTH specifies the largest request size in
4-byte units that is accepted by the server and must have a
value of at least 4096.  Requests with a length field larger
than this value are ignored and a Length error is returned.
The VENDOR string specifies the name of the manufacturer of
the font server.  The RELEASE-NUMBER specifies the particular
release of the server in a manufacturer-dependent manner.
</para>
<para>
<!-- .LP -->
After the connection is established and the setup information has been
exchanged, the client may issue any of requests described below:
</para>
<blockquote>
<para>
<!-- .LP -->
<!-- .IN "NoOp" "" "@DEF@" -->
<function>NoOp</function>
</para>
    <para>
Errors:  Alloc
    </para>
    <para>
This request does nothing.  It is typically used in response
to a
<function>KeepAlive </function>
event.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "ListExtensions" "" "@DEF@" -->
<function>ListExtensions</function>
</para>
<para>
▶
</para>

<blockquote>
  <para>
<emphasis remap='I'>names</emphasis>:  LISTofSTRING8
  </para>
  <para>
Errors:  Alloc
  </para>
  <para>
This request returns the names of the extension packages
that are supported by the server.  Extension names are
case-sensitive and are encoded in ISO 8859-1.
  </para>
</blockquote>

<para>
<!-- .IN "QueryExtension" "" "@DEF@" -->
<function>QueryExtension</function>
</para>

<blockquote>
<para>
<emphasis remap='I'>name</emphasis>:  STRING8
</para>
</blockquote>
<para>
▶
</para>

<blockquote>
  <para>
<emphasis remap='I'>present</emphasis>:  BOOL
    </para>
    <para>
<emphasis remap='I'>major-version</emphasis>:  CARD16
    </para>
    <para>
<emphasis remap='I'>minor-version</emphasis>:  CARD16
    </para>
    <para>
<emphasis remap='I'>major-opcode</emphasis>:  CARD8
    </para>
    <para>
<emphasis remap='I'>first-event</emphasis>:  CARD8
    </para>
    <para>
<emphasis remap='I'>number-events</emphasis>:  CARD8
    </para>
    <para>
<emphasis remap='I'>first-error</emphasis>:  CARD8
    </para>
    <para>
<emphasis remap='I'>number-errors</emphasis>:  CARD8
  </para>
  <para>
Errors:
<function>Alloc</function>
  </para>
  <para>
This request determines whether or not the extension package
specified by NAME (encoded in ISO 8859-1) is supported by the
server and that there is sufficient number of major opcode,
event, and error codes available.  If so, then PRESENT is set
to True, MAJOR-VERSION and MINOR-VERSION are set to the
respective major and minor version numbers of the protocol
that the server would prefer; MAJOR-OPCODE is set to the value
to use in extension requests; FIRST-EVENT is set to the value
of the first extension-specific event code or zero if the
extension does not have any events; NUMBER-EVENTS is set to
the number of new events that the event defines; FIRST-ERROR
is set to the value of the first extension-specific error code
or zero if the extension does not define any new errors; and
NUMBER-ERRORS is set to the number of new errors the extension
defines.
  </para>
  <para>
<!-- .sp -->
Otherwise, PRESENT is set to False and the remaining fields are
set to zero.
  </para>
  <para>
<!-- .sp -->
The server is free to return different values to different
clients.  Therefore, clients must use this request before
issuing any of the requests in the named extension package or
using the
<function>SetEventMask request to express interest in any of</function>
this extension's events.  Otherwise, a
<function>Request </function>
error is returned.
  </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "ListCatalogues" "" "@DEF@" -->
<function>ListCatalogues</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>max-names</emphasis>:  CARD32
    </para>
</blockquote>
<para>
<!-- .LP -->
▶+
</para>
<blockquote>
    <para>
<emphasis remap='I'>replies-following-hint</emphasis>:  CARD32
    </para>
    <para>
<emphasis remap='I'>names</emphasis>:      LISTofSTRING8
    </para>
    <para>
Errors:
<function>Alloc</function>
    </para>
    <para>
This request returns a list of at most MAX-NAMES names
of collections (called catalogues) of fonts that match
the specified PATTERN.  In the pattern (which is encoded
in ISO 8859-1), the `?' character (octal 77) matches any
single character; the `*' character (octal 52) matches
any series of zero or more characters; and alphabetic
characters match either upper- or lowercase.  The
returned NAMES are encoded in ISO 8859-1 and may contain
mixed character cases.
    </para>
    <para>
If PATTERN is of zero length or MAX-NAMES is equal to zero,
one reply containing a zero-length list of names is returned.
This may be used to synchronize the client with the server.
    </para>
    <para>
Servers are free to add or remove catalogues to the set returned by
<function>ListCatalogues</function>
between any two requests.  This request is not
cumulative; repeated uses are processed in isolation and do
result in an iteration through the list.
    </para>
    <para>
To reduce the amount of buffering needed by the server, the
list of names may be split across several reply packets, so
long as the names arrive in the same order that they would
have appeared had they been in a single packet.  The
REPLIES-FOLLOWING-HINT field in all but the last reply
contains a positive value that specifies the number of
replies that are likely, but not required, to follow.  In the
last reply, which may contain zero or more names, this field
is set to zero.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "SetCatalogues" "" "@DEF@" -->
<function>SetCatalogues</function>
</para>
<blockquote>
    <para>
<emphasis remap='I'>names</emphasis>:  LISTofSTRING8
    </para>
    <para>
Errors:
<function>Alloc , </function>
<function>Name</function>
    </para>
    <para>
This request sets the list of catalogues whose fonts should be
visible to the client.  The union of the fonts provided by
each of the named catalogues forms the set of fonts whose
names match patterns in
<function>ListFonts , </function>
<function>ListFontsWithXInfo , </function>
and
<function>OpenBitmapFont </function>
requests.  The catalogue names are
case-insensitive and are encoded in ISO 8859-1.  A zero-length
list resets the client's catalogue list to the
server-dependent default.
<!-- .sp -->
    </para>
    <para>
If any of the catalogue names are invalid, a
<function>Name </function>
error is returned and the request is ignored.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "GetCatalogues" "" "@DEF@" -->
<function>GetCatalogues</function>
</para>

<para>
▶
</para>

<blockquote>
    <para>
<emphasis remap='I'>names</emphasis>:  LISTofSTRING8
    </para>
    <para>
Errors:
<function>Alloc</function>
    </para>
    <para>
This request returns the current list of catalogue names
(encoded in ISO 8859-1) associated with the client.  These
catalogues determine the set of fonts that are visible
to
<function>ListFonts</function>,
<function>ListFontsWithXInfo</function>,
and
<function>OpenBitmapFont</function>.
A zero-length list indicates the server's default set of
fonts.  Catalogue names are case-insensitive and may be
returned in mixed case.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "SetEventMask" "" "@DEF@" -->
<function>SetEventMask</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>extension-opcode</emphasis>:  CARD8
    </para>
    <para>
<emphasis remap='I'>event-mask</emphasis>:  EVENTMASK
    </para>
    <para>
Errors:
<function>EventMask ,</function>
<function>Request</function>
    </para>
    <para>
This request specifies the set of maskable events that the
extension indicated by EXTENSION-OPCODE (or zero for the core)
should generate for the client.  Event masks are limited in
scope to the extension (or core) for which they are defined,
so expressing interest in events from one or more extensions
requires multiple uses of this request.
<!-- .sp -->
    </para>
    <para>
The default event mask if
<function>SetEventMask </function>
has not been called
is zero, indicating no interest in any maskable events.
Some events are not maskable and cannot be blocked.
<!-- .sp -->
    </para>
    <para>
If EXTENSION-OPCODE is not a valid extension opcode previously
returned by
<function>QueryExtension </function>
or zero, a
<function>Request </function>
error is
returned.  If EVENT-MASK contains any bits that do not
correspond to valid events for the specified extension (or
core), an
<function>EventMask</function>
error is returned and the request is
ignored.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "GetEventMask" "" "@DEF@" -->
<function>GetEventMask</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>extension-opcode</emphasis>:  CARD8
    </para>
</blockquote>
<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>event-mask</emphasis>:  EVENTMASK
    </para>
    <para>
Errors:
<function>Request</function>
    </para>
    <para>
This request returns the set of maskable core events the
extension indicated by EXTENSION-OPCODE (or the core if zero)
should generate for the client.  Non-maskable events are
always sent to the client.
    </para>
    <para>
If EXTENSION-OPCODE is not a valid extension opcode
previously returned by
<function>QueryExtension </function>
or zero, a
<function>Request</function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "CreateAC" "" "@DEF@" -->
<function>CreateAC</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>ac</emphasis>:  ACCESSCONTEXT
    </para>
    <para>
<emphasis remap='I'>authorization-protocols</emphasis>:  LISTofAUTH
    </para>
</blockquote>
<para>
▶
</para>

<blockquote>
    <para>
<emphasis remap='I'>status</emphasis>:       { Success, Continue, Denied }
    </para>
    <para>
<emphasis remap='I'>authorization-index</emphasis>:          CARD8
    </para>
    <para>
<emphasis remap='I'>authorization-data</emphasis>:          LISTofBYTE
    </para>
    <para>
Errors:
<function>IDChoice</function>
    </para>
    <para>
This request creates a new
<function>AccessContext </function>
object within the
server containing the specified authorization data.  When
this
<function>AccessContext</function>
is selected by the client using the
<function>SetAuthorization </function>
request, the data may be used by the server
to determine whether or not the client should be granted
access to particular font information.
    </para>
    <para>
<!-- .sp -->
If STATUS is Denied, the server rejects the client's
authorization information and does not associate AC with any
valid
<function>AccessContext .  </function>
In this case, AUTHORIZATION-INDEX is set
to zero, and zero bytes of AUTHORIZATION-DATA is returned.
    </para>
    <para>
<!-- .sp -->
Otherwise, AUTHORIZATION-INDEX is set to the index (beginning
with 1) into the AUTHORIZATION-PROTOCOLS list of the protocol
that the server will use for this connection.  If the server
does not want to use any of the given protocols, this value is
set to zero.  The AUTHORIZATION-DATA field is used to send
back authorization protocol-dependent data to the client (such
as a challenge, authentication of the server, etc.).
    </para>
    <para>
<!-- .sp -->
If STATUS is Continue, the client is expected to continue
the request by sending the following protocol and receiving
the indicated response from the server.  This continues
until STATUS is set to either Success or Denied.
    </para>
<literallayout class="monospaced">
     ◀
     more-authorization-data:          STRING8
     ▶
     status:                           { Success, Continue, Denied }
     more-authorization-data:          LISTofBYTE
</literallayout>
    <para>
Once the connection has been accepted and STATUS is Success,
the request is complete.
    </para>
    <para>
If AC is not in the range [1..2^29-1] or is already associated
with an access context, an IDChoice error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "FreeAC" "" "@DEF@" -->
<function>FreeAC</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>ac</emphasis>:  ACCESSCONTEXT
    </para>
    <para>
Errors:
<function>AccessContext , </function>
<function>Alloc</function>
    </para>
    <para>
This request indicates that the specified AC should no longer
be associated with a valid access context.  If AC is also the
current
<function>AccessContext</function>
(as set by the
<function>SetAuthorization</function>
request), an implicit
<function>SetAuthorization</function>
of None is done to
restore the
<function>AccessContext</function>
established for the initial
connection setup.  Operations on fonts that were opened under
AC are not affected.  The client may reuse the value of AC in
a subsequent
<function>CreateAC </function>
request.
    </para>
    <para>
If AC isn't associated with any valid authorization previously
created by
<function>CreateAC , an </function>
<function>AccessContext </function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "SetAuthorization" "" "@DEF@" -->
<function>SetAuthorization</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>ac</emphasis>:  ACCESSCONTEXT
    </para>
    <para>
Errors:
<function>AccessContext</function>
    </para>
    <para>
This request sets the
<function>AccessContext </function>
to be used for subsequent
requests (except for
<function>QueryXInfo</function>,
<function>QueryXExtents8</function>,
<function>QueryXExtents16</function>,
<function>QueryXBitmaps8</function>,
<function>QueryXBitmaps16</function>
and
<function>CloseFont </function>
which are done under the
<function>AccessContext </function>
of the
corresponding
<function>OpenBitmapFont</function>
")."
An AC of None restores the
<function>AccessContext</function>
established for the initial connection setup.
    </para>
    <para>
<!-- .sp -->
If AC is neither None nor a value associated with a valid
<function>AccessContext</function>
previously created by
<function>CreateAC</function>,
an
<function>AccessContext</function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "SetResolution" "" "@DEF@" -->
<function>SetResolution</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>resolutions</emphasis>:  LISTofRESOLUTION
    </para>
    <para>
Errors:
<function>Resolution</function>,
<function>Alloc</function>
    </para>
    <para>
This request provides a hint as to the resolution and
preferred point size of the drawing surfaces for which the
client will be requesting fonts.  The server may use this
information to set the RESOLUTION_X and RESOLUTION_Y fields
of scalable XLFD font names, to order sets of names based on
their resolutions, and to choose the server-dependent
instance that is used when a partially-specified scalable
fontname is opened.
    </para>
    <para>
If a zero-length list of RESOLUTIONS is given, the
server-dependent default value is restored.  Otherwise, if
elements of all of the specified RESOLUTIONS are non-zero, the
default resolutions for this client are changed.
    </para>
    <para>
If a RESOLUTION entry contains a zero, a Resolution error is
returned and the default resolutions are not changed.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "GetResolution" "" "@DEF@" -->
<function>GetResolution</function>
</para>
<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>resolutions</emphasis>:  LISTofRESOLUTION
    </para>
    <para>
Errors:
<function>Alloc</function>
    </para>
    <para>
This request returns the current list of default resolutions.
If a client has not performed a
<function>SetResolution</function>,
a server-dependent default value is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "ListFonts" "" "@DEF@" -->
<function>ListFonts</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>max-names</emphasis>:  CARD32
    </para>
</blockquote>
<para>
▶+
</para>

<blockquote>
    <para>
<emphasis remap='I'>replies-following-hint</emphasis>:  CARD32
    </para>
    <para>
<emphasis remap='I'>names</emphasis>:  LISTofSTRING8
    </para>
    <para>
Errors:
<function>Alloc</function>
    </para>
    <para>
This request returns a list of at most MAX-NAMES font names
that match the specified PATTERN, according to matching rules
of the <olink targetdoc='xlfd' targetptr='xlfd'><citetitle>X Logical
Font Description Conventions</citetitle></olink>
<xref linkend="References:xlfd-spec"/>.
In the pattern (which is encoded in ISO 8859-1) the `?' character
(octal 77) matches any single character; the `*' character
(octal 52) matches any series of zero or more characters; and
alphabetic characters match either upper- or lowercase.  The
returned NAMES are encoded in ISO 8859-1 and may contain mixed
character cases.  Font names are not required to be in XLFD
format.
    </para>
    <para>
If PATTERN is of zero length or MAX-NAMES is equal to zero,
one reply containing a zero-length list of names is returned.
This may be used to synchronize the client with the server.
    </para>
    <para>
Servers are free to add or remove fonts to the set returned by
<function>ListFonts </function>
between any two requests.  This request is not
cumulative; repeated uses are processed in isolation and do
result in an iteration through the list.
    </para>
    <para>
To reduce the amount of buffering needed by the server, the
list of names may be split across several reply packets, so
long as the names arrive in the same order that they would
have appeared had they been in a single packet.  The
REPLIES-FOLLOWING-HINT field in all but the last reply
contains a positive value that specifies the number of
replies that are likely, but not required, to follow.  In the
last reply, which may contain zero or more names, this field
is set to zero.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "ListFontsWithXInfo" "" "@DEF@" -->
<function>ListFontsWithXInfo</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>max-names</emphasis>:  CARD32
    </para>
</blockquote>

<para>
▶+
</para>

<blockquote>
    <para>
<emphasis remap='I'>replies-following-hint</emphasis>:  CARD32
    </para>
    <para>
<emphasis remap='I'>info</emphasis>:  XFONTINFO
    </para>
    <para>
<emphasis remap='I'>name</emphasis>:  STRING8
    </para>
    <para>
Errors:
<function>Alloc</function>
    </para>
    <para>
This request is similar to
<function>ListFonts </function>
except that a separate
reply containing the name, header, and property data is
generated for each matching font name.  Following these
replies, if any, a final reply containing a zero-length NAME
and no INFO is sent.
    </para>
    <para>
<!-- .sp -->
The REPLIES-FOLLOWING-HINT field in all but the last reply
contains a positive value that specifies the number of replies
that are likely, but not required, to follow.  In the last
reply, this field is set to zero.
    </para>
    <para>
<!-- .sp -->
If PATTERN is of zero length or if MAX-NAMES is equal to
zero, only the final reply containing a zero-length NAME and
no INFO is returned.  This may be used to synchronize the
client with the server.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "OpenBitmapFont" "" "@DEF@" -->
<function>OpenBitmapFont</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
<emphasis remap='I'>pattern</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>format-mask</emphasis>:  BITMAPFORMATMASK
    </para>
    <para>
<emphasis remap='I'>format-hint</emphasis>:  BITMAPFORMAT
    </para>
</blockquote>

<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>otherid</emphasis>:  FONTID or None
    </para>
    <para>
<emphasis remap='I'>otherid-valid</emphasis>:  BOOL
    </para>
    <para>
<emphasis remap='I'>cachable</emphasis>:  BOOL
    </para>
    <para>
Errors:
<function>IDChoice</function>,
<function>Name</function>,
<function>Format</function>,
<function>AccessContext</function>,
<function>Alloc</function>
    </para>
    <para>
This request looks for a server-dependent choice of the
font names that match the specified PATTERN according to the
rules described for
<function>ListFonts .  </function>
If no matches are found, a
<function>Name </function>
error is returned.  Otherwise, the server attempts to
open the font associated with the chosen name.
    </para>
    <para>
Permission to access the font is determined by the server
according the licensing policy used for this font.  The server
may use the client's current
<function>AccessContext</function>
(as set by the most
recent
<function>SetAuthorization </function>
request or the original connection
setup) to determine any client-specific sets of permissions.
After the font has been opened, the client is allowed to
specify a new
<function>AccessContext</function>
with
<function>SetAuthorization</function>
or release
the
<function>AccessContext</function>
using
<function>FreeAC</function>
.  Subsequent
<function>QueryXInfo</function>,
<function>QueryXExtents8</function>,
<function>QueryXExtents16</function>,
<function>QueryXBitmaps8</function>,
<function>QueryXBitmaps16</function>
and
<function>CloseFont</function>
requests on this FONTID are
performed according to permissions granted at the time of the
<function>OpenBitmapFont</function>
request.
    </para>
    <para>
If the server is willing and able to detect that the client
has already opened the font successfully (possibly under a
different name), the OTHERID field may be set to one of the
identifiers previously used to open the font.  The
OTHERID-VALID field indicates whether or not OTHERID is
still associated with an open font: if it is True, the
client may use OTHERID as an alternative to FONTID.
Otherwise, if OTHERID-VALID is False, OTHERID is no longer
open but has not been reused by a subsequent
<function>OpenBitmapFont</function>
request.
<!-- .sp -->
    </para>
    <para>
If OTHERID is set to None, then OTHERID-VALID should be set
to False.
<!-- .sp -->
    </para>
    <para>
The FORMAT-MASK indicates which fields in FORMAT-HINT
the client is likely to use in subsequent
<function>GetXBitmaps8</function>
and
<function>GetXBitmaps16 </function>
requests.  Servers may wish to use
this information to precompute certain values.
<!-- .sp -->
    </para>
    <para>
If CACHABLE is set to True, the client may cache the font
(so that redundant opens of the same font may be avoided)
and use it with all
<function>AccessContexts </function>
during the life of the
client without violating the font's licensing policy.  This
flag is typically set whenever a font is unlicensed or is
licensed on a per-display basis.  If CACHABLE is False, the
client should reopen the font for each
<function>AccessContext .</function>
<!-- .sp -->
    </para>
    <para>
The server is permitted to add to or remove from the set of
fonts returned by
<function>ListFonts </function>
between any two requests, though
mechanisms outside the protocol.  Therefore, it is possible
for this request (which is atomic) to return a different font
than would result from separate a
<function> ListFonts </function>
followed by an
<function>OpenBitmapFont </function>
with a non-wildcarded font name.
<!-- .sp -->
    </para>
    <para>
If FONTID is not in the range [1..2^29-1] or if it is already
associated with an open font, an
<function>IDChoice </function>
error is returned.
If no font is available that matches the specified PATTERN, a
<function>Name </function>
error is returned.  If the font is present but the client
is not permitted access, an
<function>AccessContext </function>
error is returned.
If FORMAT-MASK has any unspecified bits set or if any of the
fields in FORMAT-HINT indicated by FORMAT-MASK are invalid, a
<function>Format </function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "QueryXInfo" "" "@DEF@" -->
<function>QueryXInfo</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
</blockquote>
<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>info</emphasis>:  XFONTINFO
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Alloc</function>
    </para>
    <para>
This request returns the font header and property information
for the open font associated with FONTID.
    </para>
    <para>
<!-- .sp -->
If FONTID is not associated with any open fonts, a
<function> Font </function>
error
is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "QueryXExtents8" "" "@DEF@" -->
<function>QueryXExtents8</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
<emphasis remap='I'>range</emphasis>:  BOOL
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>chars</emphasis>:  STRING8
    </para>
</blockquote>
<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>extents</emphasis>:  LISTofXCHARINFO
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Range</function>,
<function>Alloc</function>
    </para>
    <para>
This request is equivalent to
<function>QueryXExtents16 </function>
except that it
uses 1-byte character codes.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "QueryXExtents16" "" "@DEF@" -->
<function>QueryXExtents16</function>
</para>
<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>range</emphasis>:  BOOL
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>chars</emphasis>:  LISTofCHAR2B
    </para>
</blockquote>
<para>
▶
</para>
<blockquote>
    <para>
<emphasis remap='I'>extents</emphasis>:  LISTofXCHARINFO
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Range</function>,
<function>Alloc</function>
    </para>
    <para>
This request returns a list of glyph extents from the open
font associated with FONTID for the series of characters
specified by RANGE and CHARS.
    </para>
    <para>
<!-- .sp -->
If RANGE is True, each succeeding pair of elements in CHARS is
treated as a range of characters for which extents should be
returned.  If CHARS contains an odd number of elements, the
font's XFONTINFO.CHAR-RANGE.MAX-CHAR is implicitly appended to
the list.  If CHARS contains no elements, the list is
implicitly replaced with the font's XFONTINFO.CHAR-RANGE.  If
any of the resulting character ranges are invalid, a Range
error is returned.  Otherwise, the character ranges are
concatenated in the order given by CHARS to produce a set of
character codes for which extents are returned.
    </para>
    <para>
<!-- .sp -->
If RANGE is False, then CHARS specifies the set of character
codes for which extents are returned.  If CHARS is of
zero length, then a zero-length list of extents is returned.
    </para>
    <para>
<!-- .sp -->
The extents for each character code in the resulting set (which
may contain duplicates) are returned in the order in
which the character codes appear in the set.
At least one metric for each character shall be non-zero
unless the character is not encoded in the font, in which case
all-zero metrics are returned.
A blank, zero-width character can be encoded
with non-zero but equal left and right bearings.
    </para>
    <para>
<!-- .sp -->
If FONTID is not associated with any open fonts, a
<function>Font</function>
error is
returned.  If RANGE is True and CHARS contains any invalid
ranges, a
<function>Range</function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "QueryXBitmaps8" "" "@DEF@" -->
<function>QueryXBitmaps8</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
<emphasis remap='I'>range</emphasis>:  BOOL
    </para>
    <para>
<emphasis remap='I'>chars</emphasis>:  STRING8
    </para>
    <para>
<emphasis remap='I'>format</emphasis>:  BITMAPFORMAT
    </para>
</blockquote>
<para>
▶+
</para>

<blockquote>
    <para>
<emphasis remap='I'>replies-following-hint</emphasis>:  CARD32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>offsets</emphasis>:  LISTofOFFSET32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>bitmaps</emphasis>:  LISTofBYTE
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Range</function>,
<function>Format</function>,
<function>Alloc</function>
    </para>
    <para>
This request is equivalent to
<function>QueryXBitmaps16 </function>
except that it
uses 1-byte character codes.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "QueryXBitmaps16" "" "@DEF@" -->
<function>QueryXBitmaps16</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>range</emphasis>:  BOOL
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>chars</emphasis>:  LISTofCHAR2B
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>format</emphasis>:  BITMAPFORMAT
    </para>
</blockquote>
<para>
▶+
</para>
<blockquote>
    <para>
<emphasis remap='I'>replies-following-hint</emphasis>:  CARD32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>offsets</emphasis>:  LISTofOFFSET32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>bitmaps</emphasis>:  LISTofBYTE
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Range</function>,
<function>Format</function>,
<function>Alloc</function>
    </para>
    <para>
This request returns a list of glyph bitmaps from the open
font associated with FONTID for the series of characters
specified by RANGE and CHARS.
    </para>
    <para>
<!-- .sp -->
If RANGE is True, each succeeding pair of elements in CHARS is
treated as a range of characters for which bitmaps should be
returned.  If CHARS contains an odd number of elements, the
font's XFONTINFO.CHAR-RANGE.MAX-CHAR is implicitly appended to
the list.  If CHARS contains no elements, the list is
implicitly replaced with the font's XFONTINFO.CHAR-RANGE.  If
any of the resulting character ranges are invalid, a Range
error is returned.  Otherwise, the character ranges are
concatenated in the order given by CHARS to produce a set of
character codes for which bitmaps are returned.
    </para>
    <para>
<!-- .sp -->
If RANGE is False, then CHARS specifies the set of character
codes for which bitmaps are returned.  If CHARS is of zero
length, then a single reply containing a zero-length list of
offsets and bitmaps is returned.
    </para>
    <para>
<!-- .sp -->
If any of the resulting character ranges are invalid, a Range
error is returned.  Otherwise, the resulting character ranges
are concatenated in the order given by CHARS to produce a set
of character codes for which bitmaps are returned.
    </para>
    <para>
<!-- .sp -->
The server is free to return the glyph bitmaps in multiple
replies to reduce the amount of buffering that is necessary.
In this situation, the set of characters obtained above is
partitioned into an implementation-dependent number of
ordered, non-overlapping subsets containing runs of one or
more consecutive characters.  The global ordering of
characters must be maintained such that concatenating the
subsets in order that they were produced yields the original
set.  A reply is generated for each subset, in the order that
it was produced.
    </para>
    <para>
<!-- .sp -->
For each character in a subset, an image of that character's
glyph is described by a rectangle of bits corresponding to the
pixels specified by FORMAT.IMAGE-RECT.  Within the image, set
and clear bits represent inked and non-inked pixels,
respectively.
    </para>
    <para>
<!-- .sp -->
Each scanline of a glyph image, from top to bottom, is zero-padded
on the right to a multiple of the number of bits specified by
FORMAT.SCANLINE-PAD.  The scanline is then divided from left
to right into a sequence of FORMAT.SCANLINE-UNIT bits.  The
bits of each unit are then arranged such that the left-most
pixel is stored in the most- or least-significant bit,
according to FORMAT.BIT-ORDER-MSB.  The bytes of each unit are
then arranged such that the most- or least-significant byte,
according to FORMAT.BYTE-ORDER-MSB, is transmitted first.
Finally, the units are arranged such that the left-most is
transmitted first and the right-most is transmitted last.
    </para>
    <para>
<!-- .sp -->
The individual images within a subset are then concatenated in
a server-dependent order to form the BITMAPS data of the
reply.  If a glyph image is duplicated within a reply, the
server is free to return fewer (but at least one) copies of
the image.  If a character is not encoded within the font, a
zero-length bitmap is substituted for this character.  Each
glyph image must begin at a bit position that is a multiple of
the FORMAT.SCANLINE-UNIT.
    </para>
    <para>
<!-- .sp -->
The OFFSETS array in a reply contains one entry for each
character in the subset being returned, in the order that the
characters appear in the subset.  Each entry specifies the
starting location in bytes and size in bytes of the
corresponding glyph image in the BITMAPS data of that reply
(i.e. an offset may not refer to data in another reply).
    </para>
    <para>
<!-- .sp -->
The REPLIES-FOLLOWING-HINT field in all but the last reply
contains a positive value that specifies the number of replies
that are likely, but not required, to follow.  In the last
reply, which may contain data for zero or more characters,
this field is set to zero.
    </para>
    <para>
<!-- .sp -->
If FONTID is not associated with any open fonts, a Font error
is returned.  If RANGE is True and CHARS contains any invalid
ranges, a Range error is returned.  If FORMAT is invalid, a
Format error is returned.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "CloseFont" "" "@DEF@" -->
<function>CloseFont</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID
    </para>
    <para>
Errors:
<function>Font</function>,
<function>Alloc</function>
    </para>
    <para>
This request indicates that the specified FONTID should no
longer be associated with an open font.  The server is free to
release any client-specific storage or licenses allocated for
the font.  The client may reuse the value of FONTID in a
subsequent
<function>OpenBitmapFont </function>
request.
    </para>
    <para>
<!-- .sp -->
If FONTID is not associated with any open fonts, a
<function> Font </function>
error is returned.
    </para>
</blockquote>

<para>
<!-- .LP -->
<function>"close connection"</function>
<!-- .IN "close connection" "" "@DEF@" -->
</para>

<blockquote>
    <para>
When a connection is closed, a
<function>CloseFont </function>
is done on all fonts
that are open on the connection.  In addition, the server is
free to release any storage or licenses allocated on behalf of
the client that made the connection.
    </para>
</blockquote>
</section>

<section id='Errors'>
<title>Errors</title>
<!-- .XS -->
<!-- (SN Errors -->
<!-- .XE -->
<para>
All errors are at least 16 bytes long and contain the following fields:
</para>
<blockquote>
    <para>
<emphasis remap='I'>type</emphasis>:  CARD8  value of 1
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>error-code</emphasis>:  CARD8
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>sequence-number</emphasis>:  CARD16
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>length</emphasis>:  CARD32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>timestamp</emphasis>:  TIMESTAMP
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>major-opcode</emphasis>:  CARD8
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>minor-opcode</emphasis>:  CARD8
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16
    </para>
</blockquote>
<para>
<!-- .LP -->
The TYPE field has a value of one.  The ERROR-CODE field specifies which error
occurred.  Core errors codes are in the range 0 through 127, extension error
codes are in the range 128 through 255.  The SEQUENCE-NUMBER field contains the
least significant 16 bits of the sequence number of the request that caused the
error.  The LENGTH field specifies the length of the error packet in 4-byte
units and must have a value of at least 4.  The TIMESTAMP specifies the server
time when the error occurred.  The MAJOR-OPCODE and MINOR-OPCODE (zero for core
requests) fields specify the type of request that generated the error.  The
DATA-OR-UNUSED field may be used for 16 bits of error-specific information.  If
LENGTH is greater than four, these fields are followed by (LENGTH - 4) * 4
bytes of extra data.
</para>
<para>
<!-- .LP -->
The following errors are defined for the core protocol:
</para>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Request" "@DEF@" -->
<function>Request</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
This error is generated by any request that has an unknown
combination of major and minor request numbers, or by any
extension request that is issued before a
<function>QueryExtension </function>
of that extension.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Format" "@DEF@" -->
<function>Format</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>format</emphasis>:  BITMAPFORMAT     bad format value
    </para>
    <para>
This error is generated by the use of an invalid BITMAPFORMAT
in the
<function>OpenBitmapFont</function>,
<function>QueryXBitmaps8</function>, and
<function>QueryXBitmaps16</function>
requests.
The value that caused the error is included as extra data.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Font" "@DEF@" -->
<function>Font</function>
</para>
<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>fontid</emphasis>:  FONTID     bad font identifier
    </para>
    <para>
This error is generated by an invalid FONTID in the
<function>QueryXInfo</function>,
<function>QueryXExtents8</function>,
<function>QueryXExtents16</function>,
<function>QueryXBitmaps8</function>,
<function>QueryXBitmaps16</function>
and
<function>CloseFont </function>
requests.  The value that caused
the error is included as extra data.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Range" "@DEF@" -->
<function>Range</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>range</emphasis>:  RANGE     bad range
    </para>
    <para>
This error is generated by an invalid RANGE in the
<function> QueryXExtents8</function>,
<function>QueryXExtents16</function>,
<function>QueryXBitmaps8</function>
and
<function>QueryXBitmaps16 </function>
requests.  The
value that caused the error is included as extra data.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "EventMask" "@DEF@" -->
<function>EventMask</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>event-mask</emphasis>:  EVENTMASK     bad event mask
    </para>
    <para>
This error is generated by an invalid EVENTMASK in the
<function>SetEventMask </function>
request.  The value that caused the error is
included as extra data.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "AccessContext" "@DEF@" -->
<function>AccessContext</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>ac</emphasis>:  ACCESSCONTEXT     unaccepted
<function>AccessContext</function>
    </para>
    <para>
This error is generated by an invalid ACCESSCONTEXT in the
<function>FreeAC </function>
or
<function>SetAuthorization </function>
request or by an
<function>OpenBitmapFont</function>
request performed without sufficient authorization.  In the
first two cases, the ACCESSCONTEXT of the errant request is
returned as extra data.  In the third case, the current
ACCESSCONTEXT is returned as extra data.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "IDChoice" "@DEF@" -->
<function>IDChoice</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>id</emphasis>:  ID     bad identifier
    </para>
    <para>
This error is generated by an invalid or already associated
ACCESSCONTEXT identifier in a
<function>CreateAC </function>
request or FONTID identifier
in an
<function>OpenBitmapFont </function>
request.  The value that caused the error
is included as extra data.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Name" "@DEF@" -->
<function>Name</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
This error is generated by a font name pattern that matches
no fonts in an
<function>OpenBitmapFont </function>
request or no catalogue names in a
<function>SetCatalogues </function>
request.
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Resolution" "@DEF@" -->
<function>Resolution</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     X value of errant resolution
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>y-resolution</emphasis>:  CARD16          Y value of errant resolution
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>point-size</emphasis>:  CARD16          point size of errant resolution
    </para>
    <para>
This error is generated in response to an invalid RESOLUTION
structure in a
<function>SetResolution </function>
request.  The value that caused the
error is included in the DATA-OR-UNUSED field and as extra data.
    </para>
</blockquote>

<para>
<!-- .LP      -->
<!-- .IN "Error Codes" "Alloc" "@DEF@" -->
<function>Alloc</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
This error is generated by any request for which the server
lacks sufficient resources (especially memory).
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Length" "@DEF@" -->
<function>Length</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
<emphasis remap='I'>length</emphasis>:  CARD32     bad length value
    </para>
    <para>
This error is generated by any request that has a length field
greater than (MAXIMUM-REQUEST-LENGTH * 4) bytes.  The value that
caused the error is included as extra data.
    </para>
</blockquote>
<para>
<!-- .LP -->
<!-- .IN "Error Codes" "Implementation" "@DEF@" -->
<function>Implementation</function>
</para>

<blockquote>
    <para>
<emphasis remap='I'>data-or-unused</emphasis>:  CARD16     unused
    </para>
    <para>
This error may be generated in response to any request that
the server is unable to process because it is deficient.  Use
of this error is highly discouraged and indicates lack of
conformance to the protocol.
<!-- .sp -->
Additional errors may be defined by extensions.
    </para>
</blockquote>
</section>

<section id='Events'>
<title>Events</title>
<!-- .XS -->
<!-- (SN Events -->
<!-- .XE -->
<para>
<!-- .LP -->
Events may be generated in response to requests or at the server's discretion
after the initial connection setup information has been exchanged.  Each event
is at least 12 bytes long and contains the following fields:
</para>
<blockquote>
    <para>
<!-- .TA .75i .75i .75i .75i -->
<emphasis remap='I'>type</emphasis>:  CARD8     value of 2
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>event-code</emphasis>:  CARD8
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>sequence-number</emphasis>:  CARD16
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>length</emphasis>:  CARD32
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>timestamp</emphasis>:  TIMESTAMP
    </para>
</blockquote>
<para>
<!-- .LP -->
The TYPE field contains the value 2.  The EVENT-CODE field specifies the number
of the event and is in the range 0-127 for core events or the range 128-255 for
extensions.  The SEQUENCE-NUMBER field specifies the least significant 16 bits
of the sequence number of the last request to have been processed by the
server.  The LENGTH field specifies the number of 4-byte units in this event
packet and must always have a value of at least 3.  The TIMESTAMP field
specifies the server time when the event occurred.  If LENGTH is greater than
three, these fields are followed by (LENGTH - 3) * 4 bytes of additional data.
</para>
<para>
<!-- .LP -->
Events are described using the following syntax:
</para>
<literallayout class="monospaced">
<function>EventName</function>
         <emphasis remap='I'>arg1</emphasis>: type1
         ...
         <emphasis remap='I'>argN</emphasis>: typeN

          Description
</literallayout>

<para>
If an event does not provide any extra arguments, the
<emphasis remap='I'>arg1</emphasis>...<emphasis remap='I'>argN</emphasis>
lines are omitted from the description.
</para>
<para>
<!-- .LP -->
The core X Font Service protocol defines the following events:
</para>
<para>
<!-- .LP -->
<!-- .IN "KeepAlive" "" "@DEF@" -->
<function>KeepAlive</function>
</para>
<blockquote>
    <para>
This unsolicited, nonmaskable event may be sent by the
server to verify that the connection has not been broken
(for transports that do not provide this information).
Clients should acknowledge receipt of this request
by sending any request (such as
<function>NoOp</function>
 ")."
    </para>
</blockquote>

<para>
<!-- .LP -->
<!-- .IN "CatalogueListNotify" "" "@DEF@" -->
<function>CatalogueListNotify</function>
</para>
<blockquote>
    <para>
<emphasis remap='I'>added</emphasis>:  BOOL
    </para>
    <para>
<emphasis remap='I'>deleted</emphasis>:  BOOL
    </para>
    <para>
This event is sent to clients that have included
<function>CatalogueListChangeMask </function>
in their core event mask
whenever the list of catalogues that are available has
changed.  The ADDED field is True if new catalogues have
been added to the server, otherwise it is False.  The
DELETED field is True if any existing catalogues have
been removed from the server, otherwise it is False.
    </para>
</blockquote>
<para>
<!-- .LP      -->
<!-- .IN "FontListNotify" "" "@DEF@" -->
<function>FontListNotify</function>
</para>
<blockquote>
    <para>
<emphasis remap='I'>added</emphasis>:  BOOL
    </para>
    <para>
<!-- .br -->
<emphasis remap='I'>deleted</emphasis>:  BOOL
    </para>
    <para>
This event is sent to clients that have included
<function>FontListChangeMask </function>
in their event mask whenever the
list of fonts that are provided by the currently selected
catalogues has changed.  The ADDED field is True if new
fonts have been added to any of the catalogues currently
used by the client, otherwise it is False.  The DELETED
field is True if any existing fonts have been removed
from any of catalogues used by the client, otherwise it
is False.
    </para>
    <para>
<!-- .sp -->
Additional events may be defined by extensions.
    </para>
</blockquote>
</section>
</chapter>

<chapter id='Protocol_Encoding'>
<title>Protocol Encoding</title>
<!-- .XS -->
<!-- (SN Protocol Encoding -->
<!-- .XE -->
<para>
<!-- .LP -->
Numbers that are prefixed with "#x" are in hexadecimal (base 16).  All other
numbers are in decimal.  Requests, replies, errors, events, and compound types
are described using the syntax:
</para>
<!-- .RS -->
<literallayout class="monospaced">

    Name
     <emphasis remap='I'>count</emphasis>          <emphasis remap='I'>contents</emphasis>     <emphasis remap='I'>name</emphasis>
     ...
     <emphasis remap='I'>count</emphasis>          <emphasis remap='I'>contents</emphasis>     <emphasis remap='I'>name</emphasis>
</literallayout>

<!-- .RE -->
<para>
where COUNT is the number of bytes in the data stream occupied by this
field, CONTENTS is the name of the type as given in Section 4 or the value if
this field contains a constant, and NAME is a description of this field.
</para>
<para>
<!-- .LP -->
Objects containing counted lists use a lowercase single-letter variable (whose
scope is limited to the request, reply, event, or error in which it is found)
to represent the number of objects in the list.  These variables, and any
expressions in which they are used, should be treated as unsigned integers.
Multiple copies of an object are indicated by CONTENTS prefix "LISTof".
</para>
<para>
<!-- .LP -->
Unused bytes (whose value is undefined) will have a blank CONTENTS field and a
NAME field of "unused".  Zeroed bytes (whose value must be zero) will have a
blank CONTENTS field and a NAME field of "zero".  The expression pad(e)
refers to the number of bytes needed to round a value "e" up to the closed
multiple of four:
</para>
<!-- .RS -->
<literallayout class="monospaced">

     pad(e) = (4 - (e mod 4)) mod 4
</literallayout>

<section id='Data_Types_2'>
<title>Data Types</title>
<!-- .XS -->
<!-- (SN Data Types -->
<!-- .XE -->
<!-- .sp 6p -->
<literallayout class="monospaced">
ACCESSCONTEXT

4 CARD32 access context with at least one of the following bits set:

#x1fffffff

but none of the following bits set:

#xe0000000               zero


ALTERNATESERVER
1     BOOL               subset
1     n                  length of name
n     STRING8            name
p                        unused, p=pad(n+2)

AUTH

2     n                  length of name
2     d                  length of data
n     STRING8            name
p                        unused, p=pad(n)
d     STRING8            data
q                        unused, q=pad(d)


BITMAPFORMAT

4 CARD32 value, union of the following bits:
     #x00000001           ByteOrderMSB
     #x00000002           BitOrderMSB
     #x00000000           ImageRectMin
     #x00000004           ImageRectMaxWidth
     #x00000008           ImageRectMax
     #x00000000           ScanlinePad8
     #x00000100           ScanlinePad16
     #x00000200           ScanlinePad32
     #x00000300           ScanlinePad64
     #x00000000           ScanlineUnit8
     #x00001000           ScanlineUnit16
     #x00002000           ScanlineUnit32
     #x00003000           ScanlineUnit64

except for the following bits which must be zero:

     #xffffccf0           zero

and the following of which at most one bit may be set:

     #x0000000c at most one bit can be set


BITMAPFORMATMASK

4 CARD32 value, mask of the following bits:

     #x00000001           ByteOrderMask
     #x00000002           BitOrderMask
     #x00000004           ImageRectMask
     #x00000008           ScanlinePadMask
     #x00000010           ScanlineUnitMask

except for the following bits which must be zero:

     #xffffffe0           zero

BOOL

1    BOOL       boolean, one of the following values:
0    False
1    True

BYTE
1    BYTE       unsigned byte of data

CARD8
1    CARD8       8-bit unsigned integer

CARD16
2    CARD16      16-bit unsigned integer

CARD32
4    CARD32      32-bit unsigned integer

CHAR2B
1    CARD8       byte1
1    CARD8       byte2

EVENTMASK
4    CARD32 event mask
     for core events, this is union of the following bits:

     #00000001   CatalogueListChangeMask
     #00000002   FontListChangeMask

but none of the following bits set:

     #fffffffc

extensions define their own sets of bits

FONTID

4 CARD32 font identifier with at least one of
the following bits set:

     #x1fffffff

but none of the following bits set:

     #xe0000000   zero

INT8
1    INT8         8-bit signed integer

INT16
2    INT16         16-bit signed integer

INT32
4    INT32         32-bit signed integer

OFFSET32
4    CARD32         position (or integer value)
4    CARD32         length

PROPINFO
4    n                 number of PROPOFFSET components
4    m                 number of bytes of property data
20*n PROPOFFSET         property offsets into data block
m    LISTofBYTE         property data block

PROPOFFSET
8    OFFSET32         name in data block
8    OFFSET32         value in data block

1 CARD8 type, one of the following values:
0    String
1    Unsigned
2    Signed
3    zero

RANGE
2    CHAR2B                 minimum character code
2    CHAR2B         maximum character code

RESOLUTION
2    CARD16 x resolution in pixels per inch
2    CARD16 y resolution in pixels per inch
2    CARD16 point size in decipoints

STRNAME
1    n length of name
n    STRING8 name

STRING8
n    LISTofBYTE         array of 8-bit character values

TIMESTAMP
4    CARD32         milliseconds since server time origin

XCHARINFO
2    INT16         left bearing
2    INT16         right bearing
2    INT16         width
2    INT16         ascent
2    INT16         descent
2    CARD16         attributes

XFONTINFO
4 CARD32 flags, union of the following bits:
     #x00000001         AllCharactersExist
     #x00000002         InkInside
     #x00000004         HorizontalOverlap

but none of the following bits set:

     #xfffffff8         zero
4    RANGE              range of characters in font
1    CARD8              drawing direction
     0             LeftToRight
     1             RightToLeft
1                       unused
2    CHAR2B             default character
12   XCHARINFO          minimum bounds
12   XCHARINFO          maximum bounds
2    INT16              font ascent
2    INT16              font descent
n    PROPINFO           property data
</literallayout>
</section>

<section id='Requests_2'>
<title>Requests</title>
<para><emphasis role="bold">open connection</emphasis></para>
<literallayout class="monospaced">
1     BYTE                   byteorder, one of the values:
      #x42                   MostSignificant Byte first
      #x6c                   LeastSignificant Byte first
1     CARD8                  numberof auth in auth-data
2     2                      client-major-protocol-version
2     0                      client-minor-protocol-version
2     a/4 lengthof           auth-data
a     LISTofAUTH             auth-data
▶
2     CARD16                 status
0                            Success
1                            Continue
2                            Busy
3                            Denied
2     2                      major version
2     0                      version
1     CARD8                  numberof alternate-servers-hint
1     CARD8                  authorization-index
2     a/4                    lengthof alternate-servers-hint
2     (d+q)/4                lengthof authorization-data
a     LISTofALTERNATESERVER  alternate-servers-hint
d     LISTofBYTE             authorization-data
q                            unused, q=pad(d)
</literallayout>

<para>
If STATUS is Busy or Denied, the protocol stops and the connection is
closed. If STATUS is Continue, the client is expected to respond with
additional data, to which the server responds with
a new status value and more data. This dialog continues until the status
is set to Success, or until the server sets STATUS to Busy or Denied
and closes the connection:
</para>

<literallayout class="monospaced">
◀
4     1+(d+q)/4              length
d     LISTofBYTE             more-authorization-data
q                            unused, q=pad(d)
▶
4     2+(d+q)/4              length
2     CARD16                 status
        0                    Success
      1                      Continue
      2                      Busy
      3                      Denied
      2                      unused
d     LISTofBYTE             more-authorization-data
q                            unused, q=pad(d)
</literallayout>
<para>
When STATUS is Success, the protocol resumes with the following
sent by the server:
</para>

<literallayout class="monospaced">
4     3+(v+w)/4              length of rest of data
2     CARD16                 maximum-request-length
2     v                      length of vendor string
4     CARD32                 release-number
v     STRING8                vendor-string
w                            unused, w=pad(v)
</literallayout>
<para>
Once the connection has been established, the client may send the
following requests:
</para>

<literallayout class="monospaced">
<emphasis role="bold">NoOp</emphasis>
1   0                        major-opcode
1                            unused
2   1                        length

<emphasis role="bold">ListExtensions</emphasis>
1   1                        major-opcode
1                            unused
2   1                        length
▶
1   0                        type reply
1   CARD8                    numberof names
2   CARD16                   sequence-number
4   2+(n+p)/4                length
n   LISTofSTRNAME            names
p                            unused, p=pad(n)

<emphasis role="bold">QueryExtension</emphasis>
1   2                        major-opcode
1   n                        length of name
2   1+(n+p)/4                length
n   STRING8                  name
p                            unused, p=pad(n)
▶
1   0                        type reply
1   BOOL                     present
2   CARD16                   sequence-number
4   5                        length
2   CARD16                   major-version
2   CARD16                   minor-version
1   CARD8                    major-opcode
1   CARD8                    first-event
1   CARD8                    number-events
1   CARD8                    first-error
1   CARD8                    number-errors
3                            unused

<emphasis role="bold">ListCatalogues</emphasis>
1   3                        major-opcode
1                            unused
2   3+(n+p)/4                length
4   CARD32                   max-names
2   n                        length of pattern
2                            unused
n   STRING8                  pattern
p                            unused, p=pad(n)
▶+
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   4+(n+p)/4                length
4   CARD32                   replies-following-hint
4   CARD32                   numberof catalogue-names
n   LISTofSTRNAME            catalogue-names
p                            unused, p=pad(n)

<emphasis role="bold">SetCatalogues</emphasis>
1   4                        major-opcode
1   CARD8                    numberof catalogue-names
2   1+(n+p)/4                length
n   LISTofSTRNAME            catalogue-names
p                            unused, p=pad(n)

<emphasis role="bold">GetCatalogues</emphasis>
1   5                        major-opcode
1                            unused
2   1                        length
▶
1   0                        type reply
1   CARD8                    numberof catalogue-names
2   CARD16                   sequence-number
4   2+(n+p)/4                length
n   LISTofSTRNAME            catalogue-names
p                            unused, p=pad(n)

<emphasis role="bold">SetEventMask</emphasis>
1   6                        major-opcode
1   CARD8                    extension-opcode
2   2                        length
4   EVENTMASK                event-mask

<emphasis role="bold">GetEventMask</emphasis>
1   7                        major-opcode
1   CARD8                    extension-opcode
2   1                        length
▶
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   3                        length
4   EVENTMASK                event-mask

<emphasis role="bold">CreateAC</emphasis>
1   8                        major-opcode
1   CARD8                    numberof authorization-protocols
2   2+a/4                    length
4   ACCESSCONTEXT            ac
a   LISTofAUTH               authorization-protocols
▶
1   0                        type reply
1   CARD8                    authorization-index
2   CARD16                   sequence-number
4   3+(d+q)/4                length
2   CARD16                   status
    0 Success
    1 Continue
    2 Busy
    3 Denied
2                            unused
d   LISTofBYTE               authorization-data
q                            unused, q=pad(d)
</literallayout>

<para>
If STATUS is Continue, the client is expected to respond with additional
data, to which the server
responds with a new status value and more data. This dialog continues
until the status is set to
Success, Busy, or Denied at which point the request is finished.
</para>

<literallayout class="monospaced">
◀
4   1+(d+q)/4                length
d   LISTofBYTE               more-authorization-data
q                            unused, q=pad(d)
▶
4   2+(d+q)/4                length
2   CARD16                   status
    0 Success
    1 Continue
    2 Busy
    3 Denied
2                            unused
d   LISTofBYTE               authorization-data
q                            unused, q=pad(d)

<emphasis role="bold">FreeAC</emphasis>
1   9                        major-opcode
1                            unused
2   2                        length
4   ACCESSCONTEXT            ac

<emphasis role="bold">SetAuthorization</emphasis>
1   10                       major-opcode
1                            unused
2   2                        length
4   ACCESSCONTEXT            ac

<emphasis role="bold">SetResolution</emphasis>
1   11                       major-opcode
1   n                        number of resolutions
2   1+(6*n+p)/4              length
6*n LISTofRESOLUTION         resolutions
p   p=pad(6*n)

<emphasis role="bold">GetResolution</emphasis>
1   12                       major-opcode
1                            unused
2   1                        length
▶
1   0                        type reply
1   n                        number of resolutions
2   CARD16                   sequence-number
4   2+(6*n+p)/4              length
6*n LISTofRESOLUTION         resolutions
p   p=pad(6*n)

<emphasis role="bold">ListFonts</emphasis>
1   13                       major-opcode
1                            unused
2   3+(n+p)/4                length
4   CARD32                   max-names
2   n                        length of pattern
2                            unused
n   STRING8                  pattern
p                            unused, p=pad(n)
▶+
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   4+(n+p)/4                length
4   CARD32                   replies-following-hint
4   CARD32                   numberof font-names
n   LISTofSTRNAME            font-names
p                            unused, p=pad(n)

<emphasis role="bold">ListFontsWithXInfo</emphasis>
1   14                       major-opcode
1                            unused
2   3+(n+p)/4                length
4   CARD32                   max-names
2   n                        length of pattern
2                            unused
n   STRING8                  pattern
p                            unused, p=pad(n)
▶+ (except for last in series)
1   0                        type reply
1   n                        length of name
2   CARD16                   sequence-number
4   3+(n+p+f)/4              length
4   CARD32                   replies-hint
f   XFONTINFO                fontinfo
n   STRING8                  name
p                            unused, p=pad(n)
▶ (last in series)
1   0                        type reply
1   0                        last-reply indicator
2   CARD16                   sequence-number
4   2                        reply length

<emphasis role="bold">OpenBitmapFont</emphasis>
1   15                       major-opcode
1                            unused
2   4+(n+p)/4                length
4   FONTID                   fontid
4   BITMAPFORMATMASK         format-mask
4   BITMAPFORMAT             format
n   STRNAME                  pattern
p                            unused, p=pad(n)
▶
1   0                        type reply
1   BOOL                     otherid-valid
2   CARD16                   sequence-number
4   4                        length
4   FONTID                   otherid
1   BOOL                     cachable
3                            unused

<emphasis role="bold">QueryXInfo</emphasis>
1   16                       major-opcode
1                            unused
2   2                        length
4   FONTID                   fontid
▶
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   2+f/4                    length
f   XFONTINFO                fontinfo
p                            unused, p=pad(f)

<emphasis role="bold">QueryXExtents8</emphasis>
1   17                       major-opcode
1   BOOL                     range
2   3+(n+p)/4                length
4   FONTID                   fontid
4   n                        number chars entries
n   STRING8                  chars
p                            unused, p=pad(n)
▶
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   3+3*n                    length
4   n                        number of extents
12*n LISTofXCHARINFO         extents

<emphasis role="bold">QueryXExtents16</emphasis>
1   18                       major-opcode
1   BOOL                     range
2   3+(2*n+p)/4              length
4   FONTID                   fontid
4   n                        number chars entries
2*n                          LISTofCHAR2B chars
p                            unused, p=pad(2*n)
▶
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   3+3*n                    length
4   n                        number of extents
12*n LISTofXCHARINFO         extents

<emphasis role="bold">QueryXBitmaps8</emphasis>
1   19                       major-opcode
1   BOOL                     range
2   4+(n+p)/4                length
4   FONTID                   fontid
4   BITMAPFORMAT             format
4   n                        number of chars entries
n   STRING8                  chars
p                            unused, p=pad(n)
▶+
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   5+2*n+(m+p)/4            length
4   CARD32                   replies-following-hint
4   n                        number of offsets
4   m                        number of bytes of glyph images
8*n LISTofOFFSET32           offsets
m   LISTofBYTE               glyphimages
p                            unused, p=pad(m)

<emphasis role="bold">QueryXBitmaps16</emphasis>
1   20                       major-opcode
1   BOOL                     range
2   4+(2*n+p)/4              length
4   FONTID                   fontid
4   BITMAPFORMAT             format
4   n                        number of chars entries
2*n LISTofCHAR2B             chars
p                            unused, p=pad(2*n)
▶
1   0                        type reply
1                            unused
2   CARD16                   sequence-number
4   5+2*n+(m+p)/4            length
4   CARD32                   replies-following-hint
4   n                        number of offsets
4   m                        number of bytes of glyph images
8*n LISTofOFFSET32           offsets
m   LISTofBYTE               glyphimages
p                            unused, p=pad(m)

<emphasis role="bold">CloseFont</emphasis>
1   21                       major-opcode
1                            unused
2   2                        length
4   FONTID                   fontid
</literallayout>
</section>

<section id='Errors_2'>
<title>Errors</title>
<literallayout class="monospaced">

<emphasis role="bold">Request</emphasis>
1   1                        type error
1   0                        Request
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused

<emphasis role="bold">Format</emphasis>
1   1                        type error
1   1                        Format
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   BITMAPFORMAT             bad-format

<emphasis role="bold">Font</emphasis>
1   1                        type error
1   2                        Font
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   FONTID bad-fontid

<emphasis role="bold">Range</emphasis>
1   1                        type error
1   3                        Range
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   RANGE                    bad-range

<emphasis role="bold">EventMask</emphasis>
1   1                        type error
1   4                        EventMask
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   EVENTMASK                event-mask

<emphasis role="bold">AccessContext</emphasis>
1   1                        type error
1   5                        AccessContext
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   ACCESSCONTEXT            access context

<emphasis role="bold">IDChoice</emphasis>
1   1                        type error
1   6                        IDChoice
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   FONTID                   bad-fontid

<emphasis role="bold">Name</emphasis>
1   1                        type error
1   7                        Name
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused

<emphasis role="bold">Resolution</emphasis>
1   1                        type error
1   8                        Resolution
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
6   RESOLUTION               resolution

<emphasis role="bold">Alloc</emphasis>
1   1                        type error
1   9                        Alloc
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused

<emphasis role="bold">Length</emphasis>
1   1                        type error
1   10                       Length
2   CARD16                   sequence-number
4   5                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused
4   CARD32                   bad-length

<emphasis role="bold">Implementation</emphasis>
1   1                        type error
1   11                       Implementation
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   CARD8                    major-opcode
1   CARD8                    minor-opcode
2                            unused

</literallayout>
</section>

<section id='Events_2'>
<title>Events</title>
<literallayout class="monospaced">
<emphasis role="bold">KeepAlive</emphasis>
1   2                        type event
1   0                        event KeepAlive
2   CARD16                   sequence-number
4   3                        length
4   TIMESTAMP                timestamp

<emphasis role="bold">CatalogueListNotify</emphasis>
1   2                        type event
1   1                        event CatalogueListNotify
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   BOOL                     added
1   BOOL                     deleted
2                            unused

<emphasis role="bold">FontListNotify</emphasis>
1   2                        type event
1   2                        event FontListNotify
2   CARD16                   sequence-number
4   4                        length
4   TIMESTAMP                timestamp
1   BOOL                     added
1   BOOL                     deleted
2                            unused

</literallayout>
</section>
</chapter>

<chapter id='Acknowledgements'>
<title>Acknowledgements</title>
<!-- .XS -->
<!-- (SN Acknowledgements -->
<!-- .XE -->
<para>
This document represents the culmination of several years of debate and
experiments done under the auspices of the MIT X Consortium font working group.
Although this was a group effort, the author remains responsible for any errors
or omissions.  The protocol presented here was primarily designed by Jim
Fulton, Keith Packard, and Bob Scheifler.  Special thanks goes to Ned
Batchelder, Jim Flowers, and Axel Deininger for their invigorating comments
which never failed to make this a better document.
Stephen Gildea edited version 2 of this document.
Finally, David Lemke
deserves great credit for designing and coding the sample implementation.
</para>
</chapter>

<bibliography id='References'>
<title>References</title>
<para>
All of the following documents are X Consortium standards available from
the X Consortium.
</para>
<biblioentry id='References:x11proto'>
  <abbrev>1</abbrev>
  <title><olink targetdoc='x11protocol' targetptr='x11protocol'>X Window System Protocol Version 11</olink></title>
  <author><firstname>Robert W.</firstname><surname>Scheifler</surname></author>
</biblioentry>

<biblioentry id='References:bdf-spec'>
  <abbrev>2</abbrev>
  <corpauthor>Adobe Systems</corpauthor>
  <title>Bitmap Distribution Format 2.1</title>
</biblioentry>

<biblioentry id='References:xlfd-spec'>
  <abbrev>3</abbrev>
  <corpauthor>X Consortium</corpauthor>
  <title><olink targetdoc='xlfd' targetptr='xlfd'>X Logical Font
  Description Conventions, Version 1.5</olink></title>
</biblioentry>

</bibliography>

<appendix id="suggested_licensing_policies">
<title>Suggested Licensing Policies</title>
<para>
The authorization data passed by the client in the initial connection
setup information may be used by the font server to implement restrictions
on which fonts may be accessed.  Furthermore, the font server is free to
refuse new connections at any time.
</para>
<para>
Configuration or management of the license restrictions is outside the scope of
the font service protocol and is done in a server-dependent manner.  Possible
policies might include, but are not limited to, combinations of the following:
</para>

<itemizedlist>
  <listitem>
    <para>
No restrictions - anyone may access any fonts.  The server neither
refuses any connections nor generates AccessContext errors on any
fonts.  For environments without specially-licensed fonts, this is
sufficient.
    </para>
  </listitem>
  <listitem>
    <para>
Per-machine - only those clients connecting from a known set of
machines are permitted access.  The server could get the address
of the connection and look in a list of allowed machines.
    </para>
  </listitem>
  <listitem>
    <para>
Per-user - only a known set of users may access the fonts.  The
server can use the authorization data (such as a Kerberos ticket
or a Secure RPC credential) to verify the identity of the user
and then look in a list of allowed users.
    </para>
  </listitem>
  <listitem>
    <para>
Simultaneous Use - only a certain number of clients may use a given
font at any one time.  Additional clients would receive AccessContext
errors if they attempt to open the font.  This is only effective if
the initial clients keep the font open for the entire time that it
is being used (even if all of the data has been transmitted and is
being cached).
    </para>
  </listitem>
  <listitem>
    <para>
Postage Meter - a particular font may only be accessed a limited
number of times before its license must be renewed.  Each time
the font is opened, the server decrements a counter.  When the
counter reaches zero, all further attempts to open the font
return an AccessContext error.
    </para>
  </listitem>
</itemizedlist>

<para>
It should be noted that chaining of font servers (obtaining font data from
other font servers) may conflict with certain license policies.
</para>
</appendix>

<appendix id="implementation_suggestions">
<title>Implementation Suggestions</title>
<para>
<!-- .LP -->
Font server implementations will probably wish to use techniques such as the
following to avoid limits on the number of simultaneous connections:
</para>
<itemizedlist>
  <listitem>
    <para>
The initial connection information returned by the font
server contains the names of other font servers that
may be used as substitutes.  A font server may refuse to
accept a connection, indicating that the client should
try one of the alternatives instead.
    </para>
  </listitem>
  <listitem>
    <para>
On operating systems that support processing forking, font
servers might choose to fork so that the child can continue
processing the existing connections and the parent can accept
new connections.  Such implementations are encouraged to use
shared memory so that in-memory font databases can be shared.
    </para>
  </listitem>
  <listitem>
    <para>
On operating systems that support passing stream file descriptors
between processes, cooperating font servers could collect
connections in a single process when there are few connections
and spread them among several processes as the load increases.
    </para>
  </listitem>
  <listitem>
    <para>
If a font client is unable to connect to a server (as opposed
to having the connection terminated), it should retry for an
implementation-dependent length of time (see Xlib's
handling of ECONNREFUSED in XConnDis.c).
    </para>
  </listitem>
</itemizedlist>
</appendix>
</book>