1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
5 <!ENTITY % defs SYSTEM "defs.ent"> %defs;
12 <title>The X Font Service Protocol</title>
13 <subtitle>X Consortium Standard</subtitle>
14 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
15 <releaseinfo>Version 2.0</releaseinfo>
18 <firstname>Jim</firstname><surname>Fulton</surname>
19 <affiliation><orgname>Network Computing Devices, Inc.</orgname></affiliation>
22 <edition>Revised May 2, 1994</edition>
23 <copyright><year>1991</year><holder>Network Computing Devices, Inc.</holder></copyright>
27 Permission to use, copy, modify, distribute, and sell this
28 documentation for any purpose is hereby granted without fee,
29 provided that the above copyright notice and this permission
30 notice appear in all copies. Network Computing Devices, Inc.
31 makes no representations about the suitability for any purpose
32 of the information in this document. This documentation is
33 provided "as is" without express or implied warranty.
38 <para role="multiLicensing">Copyright © 1994 X Consortium</para>
40 Permission is hereby granted, free of charge, to any person obtaining a copy
41 of this software and associated documentation files (the "Software"), to deal
42 in the Software without restriction, including without limitation the rights
43 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44 copies of the Software, and to permit persons to whom the Software is
45 furnished to do so, subject to the following conditions:
48 The above copyright notice and this permission notice shall be included in
49 all copies or substantial portions of the Software.
52 THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
56 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
57 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
60 Except as contained in this notice, the name of the X Consortium shall not be
61 used in advertising or otherwise to promote the sale, use or other dealings
62 in this Software without prior written authorization from the X Consortium.
67 <sect1 id='Introduction'>
68 <title>Introduction</title>
70 The management of fonts in large, heterogeneous environments is one of the
71 hardest aspects of using the X Window System
73 <emphasis remap='I'>X Window System</emphasis>
74 is a trademark of The Open Group.
76 . Multiple formats and the lack of
77 a consistent mechanism for exporting font data to all displays on a network
78 prevent the transparent use of applications across different display platforms.
79 The X Font Service protocol is designed to address this and other issues, with
80 specific emphasis on the needs of the core X protocol. Upward-compatible
81 changes (typically in the form of new requests) are expected as consensus is
82 reached on new features (particularly outline font support).
85 Currently, most X displays use network file protocols such as NFS and TFTP to
86 obtain raw font data which they parse directly. Since a common binary format
87 for this data doesn't exist, displays must be able to interpret a variety of
88 formats if they are to be used with different application hosts. This leads to
89 wasted code and data space and a loss of interoperability as displays are used
90 in unforeseen environments.
93 By moving the interpretation of font data out of the X server into a separate
94 service on the network, these problems can be greatly reduced. In addition,
95 new technologies, such as dynamically generating bitmaps from scaled or outline
96 fonts, can be provided to all displays transparently. For horizontal text,
97 caching techniques and increased processor power can potentially make
98 rasterization more efficient on large, centralized hosts than on individual
102 Each font server provides sets of fonts that may be listed and queried for
103 header, property, glyph extents, and bitmap information. This data is
104 transmitted over the network using a binary format (with variations to support
105 different bit- and byte-orders) designed to minimize the amount of processing
106 required by the display. Since the font server, rather than the display, is
107 responsible for parsing the raw font data, new formats can be used by all
108 displays by modifying a single font server.
111 From the user's point of view, font servers are simply a new type of name in
112 the X font path. Network name services allow descriptive names (such as
113 DEPARTMENT-FONTS or APPLICATION-FONTS) to be translated into proper network
114 addresses. X displays send requests to and read replies from the font server
115 rather than reading directly from files. Since the X Font Service protocol is
116 designed to allow subsets of the font data to be requested, displays may easily
117 implement a variety of strategies for fine-grained demand-loading of glyphs.
121 <sect1 id='Architectural_Model'>
122 <title>Architectural Model</title>
124 <!-- (SN Architectural Model -->
128 In this document, the words "client" and "server" refer to the consumer and
129 provider of a font, respectively, unless otherwise indicated. It is important
130 to note that in this context, the X server is also a font client.
133 The X Font Service protocol does not require any changes to the core X protocol
134 or to any applications. To the user, font servers are simply additional types
135 of font path elements. As such, X servers may connect to multiple font
136 servers, as shown in Figure 2.1. Although the font protocol is geared towards
137 the X Window System, it may be also used by other consumers of font data (such
141 <literallayout class="monospaced">
142 ┌────────┐ ┌───────────────┐
143 │ X1 ├──────────────┤ │
144 │ Server │ │ Font Server │
145 └────────┘ ┌───────┤ 1 │
148 │ X2 ├──────┘ ┌───────────────┐
149 │ Server ├──────────────┤ │
150 └────────┘ │ Font Server │
152 ┌─────────┐ │ └───────────────┘
159 Figure 2.1: Connecting to a Font Server
164 Clients communicate with the font server using the request/reply/event model
165 over any mutually-understood virtual stream connection (such as TCP/IP, DECnet,
167 DECnet is a trademark of Digital Equipment Corporation.
169 etc.). Font servers are responsible for providing data in the bit and byte
170 orders requested by the client. The set of requests and events provided in the
171 first version of the X Font Service protocol is limited to supporting the needs
172 of the bitmap-oriented core X Window System protocol. Extensions are expected
177 A font server reads raw font data from a variety of sources (possibly
178 including other font servers) and converts it into a common format that is
179 transmitted to the client using the protocol described in Section 4. New font
180 formats are handled by adding new converters to a font server, as shown in
184 <literallayout class="monospaced">
192 ┌─────────────────────┴──────────────────────┐
196 ├─────┬─────┬─────┬─────┬────┬─────┬───┬─────┤
197 │ bdf │ snf │ pcf │ atm │ f3 │ dwf │ │ │ ... │
198 └─────┴─────┴─────┴─────┴────┴─────┴─│─┴─────┘
209 Figure 2.2: Where Font Data Comes From
213 The server may choose to provide named sets of fonts called "catalogues."
214 Clients may specify which of the sets should be used in listing or opening a
219 An event mechanism similar to that used in the X protocol is provided for
220 asynchronous notification of clients by the server.
225 Clients may provide authorization data for the server to be used in determining
226 (according to the server's licensing policy) whether or not access should be
227 granted to particular fonts. This is particularly useful for clients whose
228 authorization changes over time (such as an X server that can verify the
229 identity of the user).
233 Implementations that wish to provide additional requests or events may use the
234 extension mechanism. Adding to the core font service protocol (with the
235 accompanying change in the major or minor version numbers) is reserved to the X
240 <sect1 id='Font_Server_Naming'>
241 <title>Font Server Naming</title>
243 <!-- (SN Font Server Naming -->
246 Font clients that expose font server names to the user are encouraged to
247 provide ways of naming font servers symbolically (e.g. DEPARTMENT-FONTS).
248 However, for environments that lack appropriate name services
249 transport-specific names are necessary. Since these names do occur in the
250 protocol, clients and servers should support at least the applicable formats
251 described below. Formats for additional transports may be registered with the
255 <sect2 id='TCPIP_Names'>
256 <title>TCP/IP Names</title>
258 <!-- (SN TCP/IP Names -->
261 The following syntax should be used for TCP/IP names:
264 <literallayout class="monospaced">
265 <TCP name> ::= "tcp/" <hostname>":" <ipportnumber> ["/" <cataloguelist>]
269 where <hostname> is either symbolic (such as expo.lcs.mit.edu) or numeric
270 decimal (such as 18.30.0.212). The <ipportnumber> is the port on
272 font server is listening for connections. The <cataloguelist> string at
273 the end is optional and specifies a plus-separated list of catalogues
274 that may be requested. For example:
276 <literallayout class="monospaced">
277 tcp/expo.lcs.mit.edu:8012/available+special
282 <sect2 id='DECnet_Names'>
283 <title>DECnet Names</title>
285 <!-- (SN DECnet Names -->
289 The following syntax should be used for DECnet names:
291 <literallayout class="monospaced">
292 <DECnet name> ::= "decnet/" <nodename> "::font$" <objname>
293 ["/" <cataloguelist>]
296 where <nodename> is either symbolic (such as SRVNOD) or the
298 form of the DECnet address (such as 44.70). The <objname> is normal,
299 case-insensitive DECnet object name. The <cataloguelist> string
301 optional and specifies a plus-separated list of catalogues that may be
302 requested. For example:
305 <literallayout class="monospaced">
306 DECNET/SRVNOD::FONT$DEFAULT/AVAILABLE
307 decnet/44.70::font$other
312 <sect1 id='Protocol'>
313 <title>Protocol</title>
315 <!-- (SN Protocol -->
319 The protocol described below uses the request/reply/error model and is
320 specified using the same conventions outlined in Section 2 of the core X Window
327 Data type names are spelled in upper case with no word separators,
334 Alternate values are capitalized with no word separators,
341 Structure element declarations are in lower case with hyphens
342 as word separators, as in: byte-order-msb
346 Structure element names are referred to in
347 upper case (e.g. BYTE-ORDER-MSB) when used in
348 descriptions to set them off from the surrounding
349 text. When this document is typeset they will be
350 printed in lower case in a distinct font.
356 Type declarations have the form "name: type",
357 as in: CARD8: 8-bit byte
362 Comma-separated lists of alternate values are enclosed in
363 braces, as in: { Min, MaxWidth, Max }
368 Comma-separated lists of structure elements are enclosed in
369 brackets, as in: [ byte1: CARD8, byte2: CARD8 ]
376 A type with a prefix "LISTof" represents a counted list of
377 elements of that type, as in: LISTofCARD8
380 <sect2 id='Data_Types'>
381 <title>Data Types</title>
383 <!-- (SN Data Types -->
386 The following data types are used in the core X Font Server protocol:
389 <literallayout class="monospaced">
394 This value is specified in the CreateAC request as the identifier
395 to be used when referring to a particular AccessContext resource
396 within the server. These resources are used by the server to
397 store client-specified authorization information. This
398 information may be used by the server to determine whether or not
399 the client should be granted access to particular font data.
403 In order to preserve the integrity of font licensing being performed by
404 the font server, care must be taken by a client to properly represent the
405 identity of the true user of the font. Some font clients will in fact
406 be servers (for example, X servers) requesting fonts for their own clients.
407 Other font clients may be doing work on behalf of a number of different
408 users over time (for example, print spoolers).
412 <function>AccessContexts </function>
413 must be created (with
414 <function>CreateAC ) </function>
415 and switched among (with
416 <function>SetAuthorization )</function>
417 to represent all of these "font users" properly.
421 <literallayout class="monospaced">
422 ALTERNATESERVER: [ name: STRING8,
428 This structure specifies the NAME, encoded in ISO 8859-1 according
429 to Section 3, of another font server that may be useful as a
430 substitute for this font server. The SUBSET field indicates
431 whether or not the alternate server is likely to only contain a
432 subset of the fonts available from this font server. This
433 information is returned during the initial connection setup and
434 may be used by the client to find a backup server in case of
439 <literallayout class="monospaced">
440 AUTH: [ name: STRING8,
446 This structure specifies the name of an authorization protocol and
447 initial data for that protocol. It is used in the authorization
448 negotiation in the initial connection setup and in the CreateAC
453 <literallayout class="monospaced">
457 <literallayout class="monospaced">
458 CARD32 containing the following fields defined by the
459 sets of values given further below
461 byte-order-msb: 1 bit,
462 bit-order-msb: 1 bit,
463 image-rect: 2 bits { Min,
467 scanline-pad: 2 bits { ScanlinePad8,
472 scanline-unit: 2 bits { ScanlineUnit8,
483 This structure specifies how glyph images are transmitted in
485 <function>QueryXBitmaps8 </function>
487 <function>QueryXBitmaps16 </function>
492 If the BYTE-ORDER-MSB bit (1 << 0) is set, the Most Significant
493 Byte of each scanline unit is returned first. Otherwise, the
494 Least Significant Byte is returned first.
498 If the BIT-ORDER-MSB bit (1 << 1) is set, the left-most bit in
499 each glyph scanline unit is stored in the Most Significant Bit of
500 each transmitted scanline unit. Otherwise, the left-most bit is
501 stored in the Least Significant Bit.
505 The IMAGE-RECT field specifies a rectangle of pixels within the
506 glyph image. It contains one of the following alternate values:
509 <literallayout class="monospaced">
510 ImageRectMin (0 << 2)
511 ImageRectMaxWidth (1 << 2)
512 ImageRectMax (2 << 2)
515 For a glyph with extents XCHARINFO in a font with header information
516 XFONTINFO, the IMAGE-RECT values have the following meanings:
519 <function>ImageRectMin -</function>
520 This refers to the minimal bounding rectangle
521 surrounding the inked pixels in the glyph. This is the
522 most compact representation. The edges of the rectangle
525 <literallayout class="monospaced">
526 left: XCHARINFO.LBEARING
527 right: XCHARINFO.RBEARING
528 top: XCHARINFO.ASCENT
529 bottom: XCHARINFO.DESCENT
533 <function>ImageRectMaxWidth - </function>
534 This refers to the scanlines between the
535 glyph's ascent and descent, padded on the left to the minimum
536 left-bearing (or 0, whichever is less) and on the right to
537 the maximum right-bearing (or logical-width, whichever is
538 greater). All glyph images share a common horizontal
539 origin. This is a combination of ImageRectMax in the
540 horizontal direction and ImageRectMin in the vertical
541 direction. The edges of the rectangle are:
544 <literallayout class="monospaced">
545 left: min (XFONTINFO.MIN-BOUNDS.LBEARING, 0)
546 right: max (XFONTINFO.MAX-BOUNDS.RBEARING,
547 XFONTINFO.MAX-BOUNDS.WIDTH)
548 top: XCHARINFO.ASCENT
549 bottom: XCHARINFO.DESCENT
553 ImageRectMax - This refers to all scanlines, from the maximum
554 ascent (or the font ascent, whichever is greater) to the
555 maximum descent (or the font descent, whichever is greater),
556 padded to the same horizontal extents as MaxWidth.
557 All glyph images have the same sized bitmap and share a
558 common origin. This is the least compact representation,
559 but may be the easiest or most efficient (particularly for
560 character cell fonts) for some clients to use. The edges of
564 <literallayout class="monospaced">
565 left: min (XFONTINFO.MIN-BOUNDS.LBEARING, 0)
566 right: max (XFONTINFO.MAX-BOUNDS.RBEARING,
567 XFONTINFO.MAX-BOUNDS.WIDTH)
568 top: max (XFONTINFO.FONT-ASCENT,
569 XFONTINFO.MAX-BOUNDS.ASCENT)
570 bottom: max (XFONTINFO.FONT-DESCENT,
571 XFONTINFO.MAX-BOUNDS.DESCENT)
574 The SCANLINE-PAD field specifies the number of bits (8, 16, 32,
575 or 64) to which each glyph scanline is padded before transmitting.
576 It contains one of the following alternate values:
578 <literallayout class="monospaced">
579 ScanlinePad8 (0 << 8)
580 ScanlinePad16 (1 << 8)
581 ScanlinePad32 (2 << 8)
582 ScanlinePad64 (3 << 8)
585 The SCANLINE-UNIT field specifies the number of bits (8, 16, 32,
586 or 64) that should be treated as a unit for swapping. This value
587 must be less than or equal to the number of bits specified by the
588 SCANLINE-PAD. It contains one of the following alternate values:
591 <literallayout class="monospaced">
592 ScanlineUnit8 (0 << 12)
593 ScanlineUnit16 (1 << 12)
594 ScanlineUnit32 (2 << 12)
595 ScanlineUnit64 (3 << 12)
598 BITMAPFORMATs are byte-swapped as CARD32s. All unspecified bits
602 Use of an invalid BITMAPFORMAT causes a Format error to
607 BITMAPFORMATMASK: CARD32 mask
611 This is a mask of bits representing the fields in a BITMAPFORMAT:
614 <literallayout class="monospaced">
615 ByteOrderMask (1 << 0)
616 BitOrderMask (1 << 1)
617 ImageRectMask (1 << 2)
618 ScanlinePadMask (1 << 3)
619 ScanlineUnitMask (1 << 4)
622 Unspecified bits are required to be zero or else a Format error
630 This is a boolean value containing one of the following alternate
634 <literallayout class="monospaced">
646 This is an unsigned byte of data whose encoding
647 is determined by the context in which it is used.
652 CARD8: 8-bit unsigned integer
656 CARD16: 16-bit unsigned integer
660 CARD32: 32-bit unsigned integer
665 These are unsigned numbers. The latter two are byte-swapped when
666 the server and client have different byte orders.
671 CHAR2B: [ byte1, byte2: CARD8 ]
675 This structure specifies an individual character code within
676 either a 2-dimensional matrix (using BYTE1 and BYTE2 as the row
677 and column indices, respectively) or a vector (using BYTE1 and
678 BYTE2 as most- and least-significant bytes, respectively). This
679 data type is treated as a pair of 8-bit values and is never
680 byte-swapped. Therefore, the client should always transmit BYTE1
686 EVENTMASK: CARD32 mask
691 This is a mask of bits indicating which of an extension's (or the
692 core's) maskable events the client would like to receive. Each
693 bit indicates one or more events, and a bit value of one indicates
694 interest in a corresponding set of events. The following bits are
695 defined for event masks specified for the core protocol (i.e. an
696 EXTENSION-OPCODE of zero in
697 <function>SetEventMask </function>
699 <function>GetEventMask </function>
703 <literallayout class="monospaced">
704 CatalogueListChangeMask (1 << 0)
705 FontListChangeMask (1 << 1)
710 <function>CatalogueListChangeMask </function>
711 is set, client is interested in
713 <function>CatalogueListNotify </function>
715 <function>FontListChangeMask </function>
716 is set, the client is interested in
718 <function>FontListNotify </function>
723 Extensions that provide additional events may define their own
724 event masks. These event masks have their own scope and may use
725 the same bit values as the core or other extensions.
727 All unused bits must be set to zero. In
728 <function>SetEventMask </function>
730 any bits are set that are not defined for the extension (or core)
731 for which this EVENTMASK is intended (according to the EXTENSION-
733 <function>SetEventMask </function>
735 <function>EventMask </function>
738 This value is swapped as a CARD32.
748 This is specified by the client in the request
749 <function>OpenBitmapFont </function>
750 as the identifier to be used when referring to a particular open
761 This is a 32-bit value in which the top 3 bits must be clear, and
762 at least 1 other bit must be set (yielding a range of 1 through
763 2^29-1). It is specified by the client to represent objects in
764 the server. Identifiers are scoped according to their type are
765 private to the client; thus, the same identifier may be used for
766 both a FONTID and an ACCESSCONTEXT as well as by multiple clients.
769 An ID of zero is referred to as None.
774 INT8: 8-bit signed integer
778 INT16: 16-bit signed integer
782 INT32: 32-bit signed integer
787 These are signed numbers. The latter two are byte-swapped when
788 the client and server have different byte orders.
792 <literallayout class="monospaced">
793 OFFSET32: [ position: CARD32,
799 This structure indicates a position and length within a block of
804 <literallayout class="monospaced">
805 PROPINFO: [ offsets: LISTofPROPOFFSET,
811 This structure describes the list of properties provided by a
812 font. Strings for all of the properties names and values are
813 stored within the data block and are located using a table of
817 This structure is padded to 32-bit alignment.
821 <literallayout class="monospaced">
822 PROPOFFSET: [ name: OFFSET32,
825 zero-pad3: BYTE, BYTE, BYTE ]
830 This structure specifies the position, length, and type of
831 of data for a property.
834 The NAME field specifies the position and length (which must be
835 greater than zero) of the property name relative to the beginning
836 of the PROPINFO.DATA block for this font. The interpretation of
837 the position and length of the VALUE field is determined by the
838 TYPE field, which contains one of the following alternate values:
842 <literallayout class="monospaced">
850 which have the following meanings:
854 This property contains a counted string of bytes. The
855 data is stored in the PROPINFO.DATA block beginning at
856 relative byte VALUE.POSITION (beginning with zero), extending
857 for VALUE.LENGTH (at least zero) bytes.
861 This property contains a unsigned, 32-bit number stored
862 as a CARD32 in VALUE.POSITION (VALUE.LENGTH is zero).
866 This property contains a signed, 32-bit number stored as
867 an INT32 in VALUE.POSITION (VALUE.LENGTH is zero).
868 This structure is zero-padded to 32-bit alignment.
874 RANGE: [ min-char, max-char: CHAR2B ]
879 This structure specifies a range of character codes. A single
880 character is represented by MIN-CHAR equals MAX-CHAR. If the
881 linear interpretation of MAX-CHAR is less than that of MIN-CHAR,
882 or if MIN-CHAR is less than the font's
883 XFONTINFO.CHAR-RANGE.MIN-CHAR, or if MAX-CHAR is greater than the
884 font's XFONTINFO.CHAR-RANGE.MAX-CHAR, the range is invalid.
888 <literallayout class="monospaced">
889 RESOLUTION: [ x-resolution: CARD16,
890 y-resolution: CARD16,
891 decipoint-size: CARD16 ]
896 This structure specifies resolution and point size to be used in
897 resolving partially-specified scaled font names. The X-RESOLUTION
898 and Y-RESOLUTION are measured in pixels-per-inch and must be
899 greater than zero. The DECIPOINT-SIZE is the preferred font
900 size, measured in tenths of a point, and must be greater than zero.
910 This is a counted list of 1-byte character codes, typically
911 encoded in ISO 8859-1. A character code "c" is equivalent to a
912 CHAR2B structure whose BYTE1 is zero and whose BYTE2 is "c".
922 This is the number of milliseconds that have passed since a server-
923 dependent origin. It is provided in errors and events and is
929 XCHARINFO: [ lbearing, rbearing: INT16,
931 ascent, descent: INT16,
937 This structure specifies the ink extents and horizontal escapement
938 (also known as the set- or logical width) of an individual
939 character. The first five values represent directed distances in
940 a coordinate system whose origin is aligned with the lower-left
941 edge of the left-most pixel of the glyph baseline (i.e. the
942 baseline falls between two pixels as shown in Figure 3-1 of the
943 "Bitmap Distribution Format 2.1" Consortium standard [2]).
947 The LBEARING field specifies the directed distance measured to the
948 right from the origin to the left edge of the left-most inked
953 The RBEARING field specifies the directed distance (measured to
954 the right) from the origin to the right edge of the right-most
955 inked pixel in the glyph.
959 The WIDTH field specifies the directed distance (measured to the
960 right) from the origin to the position where the next character
961 should appear (called the "escapement point"). This distance
962 includes any whitespace used for intercharacter padding and is
963 also referred to as the "logical width" or "horizontal
968 The ASCENT field specifies the directed distance (measured up)
969 from the baseline to the top edge of the top-most inked pixel
974 The DESCENT field specifies the directed distance (measured
975 down) from the baseline to the bottom edge of the bottom-most
980 The ATTRIBUTES field specifies glyph-specific information that
981 is passed through the application. If this value is not being
982 used, it should be zero.
985 The ink bounding box of a glyph is defined to be the smallest
986 rectangle that encloses all of the inked pixels. This box has
987 a width of RBEARING - LBEARING pixels and a height of
988 ASCENT + DESCENT pixels.
992 <literallayout class="monospaced">
993 XFONTINFO: [ flags: CARD32,
994 drawing-direction: { LeftToRight, RightToLeft }
996 default-char: CHAR2B,
997 min-bounds: XCHARINFO,
998 max-bounds: XCHARINFO,
1000 font-descent: INT16,
1001 properties: PROPINFO ]
1006 This structure specifies attributes related to the font as a
1010 The FLAGS field is a bit mask containing zero or more of the
1011 following boolean values (unspecified bits must be zero):
1014 <literallayout class="monospaced">
1015 AllCharactersExist (1 << 0)
1016 InkInside (1 << 1)
1017 HorizontalOverlap (1 << 2)
1021 which have the following meanings:
1029 If this bit is set, all of the characters
1030 in the range given by CHAR-RANGE have glyphs encoded in
1031 the font. If this bit is clear, some of the characters
1032 may not have encoded glyphs.
1041 If this bit is set, the inked pixels of each glyph
1042 fall within the rectangle described by the font's ascent,
1043 descent, origin, and the glyph's escapement point. If
1044 this bit is clear, there may be glyphs whose ink extends
1045 outside this rectangle.
1053 If this bit is set, the two ink bounding
1054 boxes (smallest rectangle enclosing the inked pixels) of
1055 some pairs of glyphs in the font may overlap when displayed
1056 side-by-side (i.e. the second character is imaged at the
1057 escapement point of the first) on a common baseline. If
1058 this bit is clear, there are no pairs of glyphs whose ink
1059 bounding boxes overlap.
1063 The DRAWING-DIRECTION field contains a hint indicating whether
1064 most of the character metrics have a positive (or "LeftToRight")
1065 logical width or a negative ("RightToLeft") logical width. It
1066 contains the following alternate values:
1068 <literallayout class="monospaced">
1073 The CHAR-RANGE.MIN-CHAR and CHAR-RANGE.MAX-CHAR fields specify the
1074 first and last character codes that have glyphs encoded in this font.
1075 All fonts must have at least one encoded glyph (in which case the
1076 MIN-CHAR and MAX-CHAR are equal), but are not required to have glyphs
1077 encoded at all positions between the first and last characters.
1080 The DEFAULT-CHAR field specifies the character code of the glyph
1081 that the client should substitute for unencoded characters. Requests
1082 for extents or bitmaps for an unencoded character generate zero-filled
1083 metrics and a zero-length glyph bitmap, respectively.
1086 The MIN-BOUNDS and MAX-BOUNDS fields contain the minimum and maximum
1087 values of each of the extents field of all encoded characters in the
1088 font (i.e. non-existent characters are ignored).
1091 The FONT-ASCENT and FONT-DESCENT fields specify the font designer's
1092 logical height of the font, above and below the baseline,
1093 respectively. The sum of the two values is often used as the
1094 vertical line spacing of the font. Individual glyphs are permitted
1095 to have ascents and descents that are greater than these values.
1098 The PROPERTIES field contains the property data associated with
1102 This structure is padded to 32-bit alignment.
1107 <sect2 id='Requests'>
1108 <title>Requests</title>
1110 <!-- (SN Requests -->
1114 This section describes the requests that may be sent by the client and the
1115 replies or errors that are generated in response. Versions of the protocol
1116 with the same major version are required to be upward-compatible.
1120 Every request on a given connection is implicitly assigned a sequence number,
1121 starting with 1, that is used in replies, error, and events. Servers are
1122 required to generate replies and errors in the order in which the corresponding
1123 requests are received. Servers are permitted to add or remove fonts to the
1124 list visible to the client between any two requests, but requests must be
1125 processed atomically. Each request packet is at least 4 bytes long and
1126 contains the following fields:
1129 <literallayout class="monospaced">
1136 The MAJOR-OPCODE specifies which core request or extension package this packet
1137 represents. If the MAJOR-OPCODE corresponds to a core request, the
1138 MINOR-OPCODE contains 8 bits of request-specific data. Otherwise, the
1139 MINOR-OPCODE specifies which extension request this packet represents. The
1140 LENGTH field specifies the number of 4-byte units contained within the packet
1141 and must be at least one. If this field contains a value greater than one it
1142 is followed by (LENGTH - 1) * 4 bytes of request-specific data. Unless
1143 otherwise specified, unused bytes are not required to be zero.
1147 If a request packet contains too little or too much data, the server returns
1148 a Length error. If the server runs out of internal resources (such as
1149 memory) while processing a request, it returns an Alloc error. If a server is
1150 deficient (and therefore non-compliant) and is unable to process a request, it
1151 may return an Implementation error. If a client uses an extension request
1152 without previously having issued a
1153 <function>QueryExtension </function>
1154 request for that extension, the server responds with a
1155 <function>Request </function>
1156 error. If the server encounters a request
1157 with an unknown MAJOR-OPCODE or MINOR-OPCODE, it responds with a
1158 <function>Request </function>
1160 At most one error is generated per request. If more than one error condition
1161 is encountered in processing a requests, the choice of which error is returned
1162 is server-dependent.
1166 Core requests have MAJOR-OPCODE values between 0 and 127, inclusive. Extension
1167 requests have MAJOR-OPCODE values between 128 and 255, inclusive, that are
1168 assigned by by the server. All MINOR-OPCODE values in extension requests are
1169 between 0 and 255, inclusive.
1173 Each reply is at least 8 bytes long and contains the following fields:
1176 <literallayout class="monospaced">
1177 type: CARD8 value of 0
1178 data-or-unused: CARD8
1179 sequence-number: CARD16
1184 The TYPE field has a value of zero. The DATA-OR-UNUSED field may be used to
1185 encode one byte of reply-specific data (see Section 5.2 on request encoding).
1186 The least-significant 16 bits of the sequence number of the request that
1187 generated the reply are stored in the SEQUENCE-NUMBER field. The LENGTH field
1188 specifies the number of 4-byte units in this reply packet, including the fields
1189 described above, and must be at least two. If LENGTH is greater than two, the
1190 fields described above are followed by (LENGTH - 2) * 4 bytes of additional
1195 Requests that have replies are described using the following syntax:
1198 <literallayout class="monospaced">
1200 <emphasis remap='I'>arg1</emphasis>: type1
1201 <emphasis remap='I'>arg2</emphasis>: type2
1203 <emphasis remap='I'>argN</emphasis>: typeN
1205 <emphasis remap='I'>result1</emphasis>: type1
1206 <emphasis remap='I'>result2</emphasis>: type2
1208 <emphasis remap='I'>resultM</emphasis>: typeM
1210 Errors: <emphasis remap='I'>kind1</emphasis>, <emphasis remap='I'>kind2</emphasis> ..., <emphasis remap='I'>kindK</emphasis>
1216 If a request does not generate a reply, the"=>" and result lines are
1217 omitted. If a request may generate multiple replies, the "=>" is replaced by
1218 a "=>+". In the authorization data exchanges in the initial connection setup
1219 and the CreateAC request, "->" indicates data sent by the client in response
1220 to data sent by the server.
1224 The protocol begins with the establishment of a connection over a
1225 mutually-understood virtual stream:
1228 <literallayout class="monospaced">
1232 client-major-protocol-version: CARD16
1233 client-minor-protocol-version: CARD16
1234 authorization-protocols: LISTofAUTH
1237 The initial byte of the connection specifies the BYTE-ORDER in
1238 which subsequent 16-bit and 32-bit numeric values are to be
1239 transmitted. The octal value 102 (ASCII uppercase `B')
1240 indicates that the most-significant byte is to be transmitted
1241 first; the octal value 154 (ASCII lowercase `l') indicates
1242 that the least-significant byte is to be transmitted first.
1243 If any other value is encountered the server closes the
1244 connection without any response.
1249 The CLIENT-MAJOR-PROTOCOL-VERSION and
1250 CLIENT-MINOR-PROTOCOL-VERSION specify which version of the
1251 font service protocol the client would like to use. If the
1252 client can support multiple versions, the highest version
1253 should be given. This version of the protocol has a
1254 major version of 2 and a minor version of 0.
1257 The AUTHORIZATION-PROTOCOLS contains a list of protocol names and
1258 optional initial data for which the client can provide
1259 information. The server may use this to determine which
1260 protocol to use or as part of the initial exchange of
1263 <literallayout class="monospaced">
1265 status: { Success, Continue,
1267 server-major-protocol-version: CARD16
1268 server-minor-protocol-version: CARD16
1269 alternate-servers-hint: LISTofALTERNATESERVER
1270 authorization-index: CARD8
1271 authorization-data: LISTofBYTE
1275 The SERVER-MAJOR-PROTOCOL-VERSION and
1276 SERVER-MINOR-PROTOCOL-VERSION specify the version of the font
1277 service protocol that the server expects from the client. If
1278 the server supports the version specified by the client, this
1279 version number should be returned. If the client has
1280 requested a higher version than is supported by the server,
1281 the server's highest version should be returned. Otherwise,
1282 if the client has requested a lower version than is supported
1283 by the server, the server's lowest version should be returned.
1284 It is the client's responsibility to decide whether or not it
1285 can match this version of the protocol.
1288 The ALTERNATE-SERVERS-HINT is a list of other font servers
1289 that may have related sets of fonts (determined by means
1290 outside this protocol, typically by the system administrator).
1291 Clients may choose to contact these font servers if the
1292 connection is rejected or lost.
1295 The STATUS field indicates whether the server accepted,
1296 rejected, or would like more information about the connection.
1297 It has one of the following alternate values:
1299 <literallayout class="monospaced">
1308 If STATUS is Denied, the server has rejected the client's
1309 authorization information. If STATUS is Busy, the server has
1310 simply decided that it cannot provide fonts to this client at
1311 this time (it may be able to at a later time). In both cases,
1312 AUTHORIZATION-INDEX is set to zero, no authorization-data is
1313 returned, and the server closes the connection after sending
1314 the data described so far.
1317 Otherwise the AUTHORIZATION-INDEX is set to the index
1318 (beginning with 1) into the AUTHORIZATION-PROTOCOLS list of
1319 the protocol that the server will use for this connection. If
1320 the server does not want to use any of the given protocols,
1321 this value is set to zero. The AUTHORIZATION-DATA field is
1322 used to send back authorization protocol-dependent data to the
1323 client (such as a challenge, authentication of the server,
1330 If STATUS is Success, the following section of protocol is
1331 omitted. Otherwise, if STATUS is Continue, the server expects
1332 more authorization data from the client (i.e. the connection
1333 setup is not finished, so no requests or events may be sent):
1336 <literallayout class="monospaced">
1338 more-authorization-data: STRING8
1340 status: { Success, Continue,
1342 more-authorization-data: LISTofBYTE
1347 The values in STATUS have the same meanings as described
1348 above. This section of protocol is repeated until the server
1349 either accepts (sets STATUS to Success) or rejects (sets
1350 STATUS to Denied or Busy) the connection.
1354 Once the connection has been accepted and STATUS is Success,
1355 an implicit AccessContext is created for the authorization
1356 data and the protocol continues with the following data sent
1360 <literallayout class="monospaced">
1362 remaining-length: CARD32
1363 maximum-request-length: CARD16
1364 release-number: CARD32
1368 The REMAINING-LENGTH specifies the length in 4-byte units of
1369 the remaining data to be transmitted to the client. The
1370 MAXIMUM-REQUEST-LENGTH specifies the largest request size in
1371 4-byte units that is accepted by the server and must have a
1372 value of at least 4096. Requests with a length field larger
1373 than this value are ignored and a Length error is returned.
1374 The VENDOR string specifies the name of the manufacturer of
1375 the font server. The RELEASE-NUMBER specifies the particular
1376 release of the server in a manufacturer-dependent manner.
1380 After the connection is established and the setup information has been
1381 exchanged, the client may issue any of requests described below:
1386 <!-- .IN "NoOp" "" "@DEF@" -->
1387 <function>NoOp</function>
1393 This request does nothing. It is typically used in response
1395 <function>KeepAlive </function>
1402 <!-- .IN "ListExtensions" "" "@DEF@" -->
1403 <function>ListExtensions</function>
1411 <emphasis remap='I'>names</emphasis>: LISTofSTRING8
1417 This request returns the names of the extension packages
1418 that are supported by the server. Extension names are
1419 case-sensitive and are encoded in ISO 8859-1.
1424 <!-- .IN "QueryExtension" "" "@DEF@" -->
1425 <function>QueryExtension</function>
1430 <emphasis remap='I'>name</emphasis>: STRING8
1439 <emphasis remap='I'>present</emphasis>: BOOL
1442 <emphasis remap='I'>major-version</emphasis>: CARD16
1445 <emphasis remap='I'>minor-version</emphasis>: CARD16
1448 <emphasis remap='I'>major-opcode</emphasis>: CARD8
1451 <emphasis remap='I'>first-event</emphasis>: CARD8
1454 <emphasis remap='I'>number-events</emphasis>: CARD8
1457 <emphasis remap='I'>first-error</emphasis>: CARD8
1460 <emphasis remap='I'>number-errors</emphasis>: CARD8
1464 <function>Alloc</function>
1467 This request determines whether or not the extension package
1468 specified by NAME (encoded in ISO 8859-1) is supported by the
1469 server and that there is sufficient number of major opcode,
1470 event, and error codes available. If so, then PRESENT is set
1471 to True, MAJOR-VERSION and MINOR-VERSION are set to the
1472 respective major and minor version numbers of the protocol
1473 that the server would prefer; MAJOR-OPCODE is set to the value
1474 to use in extension requests; FIRST-EVENT is set to the value
1475 of the first extension-specific event code or zero if the
1476 extension does not have any events; NUMBER-EVENTS is set to
1477 the number of new events that the event defines; FIRST-ERROR
1478 is set to the value of the first extension-specific error code
1479 or zero if the extension does not define any new errors; and
1480 NUMBER-ERRORS is set to the number of new errors the extension
1485 Otherwise, PRESENT is set to False and the remaining fields are
1490 The server is free to return different values to different
1491 clients. Therefore, clients must use this request before
1492 issuing any of the requests in the named extension package or
1494 <function>SetEventMask request to express interest in any of</function>
1495 this extension's events. Otherwise, a
1496 <function>Request </function>
1503 <!-- .IN "ListCatalogues" "" "@DEF@" -->
1504 <function>ListCatalogues</function>
1509 <emphasis remap='I'>pattern</emphasis>: STRING8
1512 <emphasis remap='I'>max-names</emphasis>: CARD32
1521 <emphasis remap='I'>replies-following-hint</emphasis>: CARD32
1524 <emphasis remap='I'>names</emphasis>: LISTofSTRING8
1528 <function>Alloc</function>
1531 This request returns a list of at most MAX-NAMES names
1532 of collections (called catalogues) of fonts that match
1533 the specified PATTERN. In the pattern (which is encoded
1534 in ISO 8859-1), the `?' character (octal 77) matches any
1535 single character; the `*' character (octal 52) matches
1536 any series of zero or more characters; and alphabetic
1537 characters match either upper- or lowercase. The
1538 returned NAMES are encoded in ISO 8859-1 and may contain
1539 mixed character cases.
1542 If PATTERN is of zero length or MAX-NAMES is equal to zero,
1543 one reply containing a zero-length list of names is returned.
1544 This may be used to synchronize the client with the server.
1547 Servers are free to add or remove catalogues to the set returned by
1548 <function>ListCatalogues</function>
1549 between any two requests. This request is not
1550 cumulative; repeated uses are processed in isolation and do
1551 result in an iteration through the list.
1554 To reduce the amount of buffering needed by the server, the
1555 list of names may be split across several reply packets, so
1556 long as the names arrive in the same order that they would
1557 have appeared had they been in a single packet. The
1558 REPLIES-FOLLOWING-HINT field in all but the last reply
1559 contains a positive value that specifies the number of
1560 replies that are likely, but not required, to follow. In the
1561 last reply, which may contain zero or more names, this field
1568 <!-- .IN "SetCatalogues" "" "@DEF@" -->
1569 <function>SetCatalogues</function>
1573 <emphasis remap='I'>names</emphasis>: LISTofSTRING8
1577 <function>Alloc , </function>
1578 <function>Name</function>
1581 This request sets the list of catalogues whose fonts should be
1582 visible to the client. The union of the fonts provided by
1583 each of the named catalogues forms the set of fonts whose
1584 names match patterns in
1585 <function>ListFonts , </function>
1586 <function>ListFontsWithXInfo , </function>
1588 <function>OpenBitmapFont </function>
1589 requests. The catalogue names are
1590 case-insensitive and are encoded in ISO 8859-1. A zero-length
1591 list resets the client's catalogue list to the
1592 server-dependent default.
1596 If any of the catalogue names are invalid, a
1597 <function>Name </function>
1598 error is returned and the request is ignored.
1604 <!-- .IN "GetCatalogues" "" "@DEF@" -->
1605 <function>GetCatalogues</function>
1614 <emphasis remap='I'>names</emphasis>: LISTofSTRING8
1618 <function>Alloc</function>
1621 This request returns the current list of catalogue names
1622 (encoded in ISO 8859-1) associated with the client. These
1623 catalogues determine the set of fonts that are visible
1625 <function>ListFonts</function>,
1626 <function>ListFontsWithXInfo</function>,
1628 <function>OpenBitmapFont</function>.
1629 A zero-length list indicates the server's default set of
1630 fonts. Catalogue names are case-insensitive and may be
1631 returned in mixed case.
1637 <!-- .IN "SetEventMask" "" "@DEF@" -->
1638 <function>SetEventMask</function>
1643 <emphasis remap='I'>extension-opcode</emphasis>: CARD8
1646 <emphasis remap='I'>event-mask</emphasis>: EVENTMASK
1650 <function>EventMask ,</function>
1651 <function>Request</function>
1654 This request specifies the set of maskable events that the
1655 extension indicated by EXTENSION-OPCODE (or zero for the core)
1656 should generate for the client. Event masks are limited in
1657 scope to the extension (or core) for which they are defined,
1658 so expressing interest in events from one or more extensions
1659 requires multiple uses of this request.
1663 The default event mask if
1664 <function>SetEventMask </function>
1666 is zero, indicating no interest in any maskable events.
1667 Some events are not maskable and cannot be blocked.
1671 If EXTENSION-OPCODE is not a valid extension opcode previously
1673 <function>QueryExtension </function>
1675 <function>Request </function>
1677 returned. If EVENT-MASK contains any bits that do not
1678 correspond to valid events for the specified extension (or
1680 <function>EventMask</function>
1681 error is returned and the request is
1688 <!-- .IN "GetEventMask" "" "@DEF@" -->
1689 <function>GetEventMask</function>
1694 <emphasis remap='I'>extension-opcode</emphasis>: CARD8
1702 <emphasis remap='I'>event-mask</emphasis>: EVENTMASK
1706 <function>Request</function>
1709 This request returns the set of maskable core events the
1710 extension indicated by EXTENSION-OPCODE (or the core if zero)
1711 should generate for the client. Non-maskable events are
1712 always sent to the client.
1715 If EXTENSION-OPCODE is not a valid extension opcode
1716 previously returned by
1717 <function>QueryExtension </function>
1719 <function>Request</function>
1726 <!-- .IN "CreateAC" "" "@DEF@" -->
1727 <function>CreateAC</function>
1732 <emphasis remap='I'>ac</emphasis>: ACCESSCONTEXT
1735 <emphasis remap='I'>authorization-protocols</emphasis>: LISTofAUTH
1744 <emphasis remap='I'>status</emphasis>: { Success, Continue, Denied }
1747 <emphasis remap='I'>authorization-index</emphasis>: CARD8
1750 <emphasis remap='I'>authorization-data</emphasis>: LISTofBYTE
1754 <function>IDChoice</function>
1757 This request creates a new
1758 <function>AccessContext </function>
1760 server containing the specified authorization data. When
1762 <function>AccessContext</function>
1763 is selected by the client using the
1764 <function>SetAuthorization </function>
1765 request, the data may be used by the server
1766 to determine whether or not the client should be granted
1767 access to particular font information.
1771 If STATUS is Denied, the server rejects the client's
1772 authorization information and does not associate AC with any
1774 <function>AccessContext . </function>
1775 In this case, AUTHORIZATION-INDEX is set
1776 to zero, and zero bytes of AUTHORIZATION-DATA is returned.
1780 Otherwise, AUTHORIZATION-INDEX is set to the index (beginning
1781 with 1) into the AUTHORIZATION-PROTOCOLS list of the protocol
1782 that the server will use for this connection. If the server
1783 does not want to use any of the given protocols, this value is
1784 set to zero. The AUTHORIZATION-DATA field is used to send
1785 back authorization protocol-dependent data to the client (such
1786 as a challenge, authentication of the server, etc.).
1790 If STATUS is Continue, the client is expected to continue
1791 the request by sending the following protocol and receiving
1792 the indicated response from the server. This continues
1793 until STATUS is set to either Success or Denied.
1795 <literallayout class="monospaced">
1797 more-authorization-data: STRING8
1799 status: { Success, Continue, Denied }
1800 more-authorization-data: LISTofBYTE
1803 Once the connection has been accepted and STATUS is Success,
1804 the request is complete.
1807 If AC is not in the range [1..2^29-1] or is already associated
1808 with an access context, an IDChoice error is returned.
1814 <!-- .IN "FreeAC" "" "@DEF@" -->
1815 <function>FreeAC</function>
1820 <emphasis remap='I'>ac</emphasis>: ACCESSCONTEXT
1824 <function>AccessContext , </function>
1825 <function>Alloc</function>
1828 This request indicates that the specified AC should no longer
1829 be associated with a valid access context. If AC is also the
1831 <function>AccessContext</function>
1833 <function>SetAuthorization</function>
1834 request), an implicit
1835 <function>SetAuthorization</function>
1838 <function>AccessContext</function>
1839 established for the initial
1840 connection setup. Operations on fonts that were opened under
1841 AC are not affected. The client may reuse the value of AC in
1843 <function>CreateAC </function>
1847 If AC isn't associated with any valid authorization previously
1849 <function>CreateAC , an </function>
1850 <function>AccessContext </function>
1857 <!-- .IN "SetAuthorization" "" "@DEF@" -->
1858 <function>SetAuthorization</function>
1863 <emphasis remap='I'>ac</emphasis>: ACCESSCONTEXT
1867 <function>AccessContext</function>
1870 This request sets the
1871 <function>AccessContext </function>
1872 to be used for subsequent
1873 requests (except for
1874 <function>QueryXInfo</function>,
1875 <function>QueryXExtents8</function>,
1876 <function>QueryXExtents16</function>,
1877 <function>QueryXBitmaps8</function>,
1878 <function>QueryXBitmaps16</function>
1880 <function>CloseFont </function>
1881 which are done under the
1882 <function>AccessContext </function>
1885 <function>OpenBitmapFont</function>
1887 An AC of None restores the
1888 <function>AccessContext</function>
1889 established for the initial connection setup.
1893 If AC is neither None nor a value associated with a valid
1894 <function>AccessContext</function>
1895 previously created by
1896 <function>CreateAC</function>,
1898 <function>AccessContext</function>
1905 <!-- .IN "SetResolution" "" "@DEF@" -->
1906 <function>SetResolution</function>
1911 <emphasis remap='I'>resolutions</emphasis>: LISTofRESOLUTION
1915 <function>Resolution</function>,
1916 <function>Alloc</function>
1919 This request provides a hint as to the resolution and
1920 preferred point size of the drawing surfaces for which the
1921 client will be requesting fonts. The server may use this
1922 information to set the RESOLUTION_X and RESOLUTION_Y fields
1923 of scalable XLFD font names, to order sets of names based on
1924 their resolutions, and to choose the server-dependent
1925 instance that is used when a partially-specified scalable
1929 If a zero-length list of RESOLUTIONS is given, the
1930 server-dependent default value is restored. Otherwise, if
1931 elements of all of the specified RESOLUTIONS are non-zero, the
1932 default resolutions for this client are changed.
1935 If a RESOLUTION entry contains a zero, a Resolution error is
1936 returned and the default resolutions are not changed.
1941 <!-- .IN "GetResolution" "" "@DEF@" -->
1942 <function>GetResolution</function>
1949 <emphasis remap='I'>resolutions</emphasis>: LISTofRESOLUTION
1953 <function>Alloc</function>
1956 This request returns the current list of default resolutions.
1957 If a client has not performed a
1958 <function>SetResolution</function>,
1959 a server-dependent default value is returned.
1965 <!-- .IN "ListFonts" "" "@DEF@" -->
1966 <function>ListFonts</function>
1971 <emphasis remap='I'>pattern</emphasis>: STRING8
1974 <emphasis remap='I'>max-names</emphasis>: CARD32
1983 <emphasis remap='I'>replies-following-hint</emphasis>: CARD32
1986 <emphasis remap='I'>names</emphasis>: LISTofSTRING8
1990 <function>Alloc</function>
1993 This request returns a list of at most MAX-NAMES font names
1994 that match the specified PATTERN, according to matching rules
1995 of the X Logical Font Description Conventions [3]. In the
1996 pattern (which is encoded in ISO 8859-1) the `?' character
1997 (octal 77) matches any single character; the `*' character
1998 (octal 52) matches any series of zero or more characters; and
1999 alphabetic characters match either upper- or lowercase. The
2000 returned NAMES are encoded in ISO 8859-1 and may contain mixed
2001 character cases. Font names are not required to be in XLFD
2005 If PATTERN is of zero length or MAX-NAMES is equal to zero,
2006 one reply containing a zero-length list of names is returned.
2007 This may be used to synchronize the client with the server.
2010 Servers are free to add or remove fonts to the set returned by
2011 <function>ListFonts </function>
2012 between any two requests. This request is not
2013 cumulative; repeated uses are processed in isolation and do
2014 result in an iteration through the list.
2017 To reduce the amount of buffering needed by the server, the
2018 list of names may be split across several reply packets, so
2019 long as the names arrive in the same order that they would
2020 have appeared had they been in a single packet. The
2021 REPLIES-FOLLOWING-HINT field in all but the last reply
2022 contains a positive value that specifies the number of
2023 replies that are likely, but not required, to follow. In the
2024 last reply, which may contain zero or more names, this field
2031 <!-- .IN "ListFontsWithXInfo" "" "@DEF@" -->
2032 <function>ListFontsWithXInfo</function>
2037 <emphasis remap='I'>pattern</emphasis>: STRING8
2040 <emphasis remap='I'>pattern</emphasis>: STRING8
2043 <emphasis remap='I'>pattern</emphasis>: STRING8
2046 <emphasis remap='I'>max-names</emphasis>: CARD32
2056 <emphasis remap='I'>replies-following-hint</emphasis>: CARD32
2059 <emphasis remap='I'>info</emphasis>: XFONTINFO
2062 <emphasis remap='I'>name</emphasis>: STRING8
2066 <function>Alloc</function>
2069 This request is similar to
2070 <function>ListFonts </function>
2071 except that a separate
2072 reply containing the name, header, and property data is
2073 generated for each matching font name. Following these
2074 replies, if any, a final reply containing a zero-length NAME
2075 and no INFO is sent.
2079 The REPLIES-FOLLOWING-HINT field in all but the last reply
2080 contains a positive value that specifies the number of replies
2081 that are likely, but not required, to follow. In the last
2082 reply, this field is set to zero.
2086 If PATTERN is of zero length or if MAX-NAMES is equal to
2087 zero, only the final reply containing a zero-length NAME and
2088 no INFO is returned. This may be used to synchronize the
2089 client with the server.
2095 <!-- .IN "OpenBitmapFont" "" "@DEF@" -->
2096 <function>OpenBitmapFont</function>
2101 <emphasis remap='I'>fontid</emphasis>: FONTID
2104 <emphasis remap='I'>pattern</emphasis>: STRING8
2107 <emphasis remap='I'>format-mask</emphasis>: BITMAPFORMATMASK
2110 <emphasis remap='I'>format-hint</emphasis>: BITMAPFORMAT
2119 <emphasis remap='I'>otherid</emphasis>: FONTID or None
2122 <emphasis remap='I'>otherid-valid</emphasis>: BOOL
2125 <emphasis remap='I'>cachable</emphasis>: BOOL
2129 <function>IDChoice</function>,
2130 <function>Name</function>,
2131 <function>Format</function>,
2132 <function>AccessContext</function>,
2133 <function>Alloc</function>
2136 This request looks for a server-dependent choice of the
2137 font names that match the specified PATTERN according to the
2139 <function>ListFonts . </function>
2140 If no matches are found, a
2141 <function>Name </function>
2142 error is returned. Otherwise, the server attempts to
2143 open the font associated with the chosen name.
2146 Permission to access the font is determined by the server
2147 according the licensing policy used for this font. The server
2148 may use the client's current
2149 <function>AccessContext</function>
2152 <function>SetAuthorization </function>
2153 request or the original connection
2154 setup) to determine any client-specific sets of permissions.
2155 After the font has been opened, the client is allowed to
2157 <function>AccessContext</function>
2159 <function>SetAuthorization</function>
2162 <function>AccessContext</function>
2164 <function>FreeAC</function>
2166 <function>QueryXInfo</function>,
2167 <function>QueryXExtents8</function>,
2168 <function>QueryXExtents16</function>,
2169 <function>QueryXBitmaps8</function>,
2170 <function>QueryXBitmaps16</function>
2172 <function>CloseFont</function>
2173 requests on this FONTID are
2174 performed according to permissions granted at the time of the
2175 <function>OpenBitmapFont</function>
2179 If the server is willing and able to detect that the client
2180 has already opened the font successfully (possibly under a
2181 different name), the OTHERID field may be set to one of the
2182 identifiers previously used to open the font. The
2183 OTHERID-VALID field indicates whether or not OTHERID is
2184 still associated with an open font: if it is True, the
2185 client may use OTHERID as an alternative to FONTID.
2186 Otherwise, if OTHERID-VALID is False, OTHERID is no longer
2187 open but has not been reused by a subsequent
2188 <function>OpenBitmapFont</function>
2193 If OTHERID is set to None, then OTHERID-VALID should be set
2198 The FORMAT-MASK indicates which fields in FORMAT-HINT
2199 the client is likely to use in subsequent
2200 <function>GetXBitmaps8</function>
2202 <function>GetXBitmaps16 </function>
2203 requests. Servers may wish to use
2204 this information to precompute certain values.
2208 If CACHABLE is set to True, the client may cache the font
2209 (so that redundant opens of the same font may be avoided)
2211 <function>AccessContexts </function>
2212 during the life of the
2213 client without violating the font's licensing policy. This
2214 flag is typically set whenever a font is unlicensed or is
2215 licensed on a per-display basis. If CACHABLE is False, the
2216 client should reopen the font for each
2217 <function>AccessContext .</function>
2221 The server is permitted to add to or remove from the set of
2223 <function>ListFonts </function>
2224 between any two requests, though
2225 mechanisms outside the protocol. Therefore, it is possible
2226 for this request (which is atomic) to return a different font
2227 than would result from separate a
2228 <function> ListFonts </function>
2230 <function>OpenBitmapFont </function>
2231 with a non-wildcarded font name.
2235 If FONTID is not in the range [1..2^29-1] or if it is already
2236 associated with an open font, an
2237 <function>IDChoice </function>
2239 If no font is available that matches the specified PATTERN, a
2240 <function>Name </function>
2241 error is returned. If the font is present but the client
2242 is not permitted access, an
2243 <function>AccessContext </function>
2245 If FORMAT-MASK has any unspecified bits set or if any of the
2246 fields in FORMAT-HINT indicated by FORMAT-MASK are invalid, a
2247 <function>Format </function>
2254 <!-- .IN "QueryXInfo" "" "@DEF@" -->
2255 <function>QueryXInfo</function>
2260 <emphasis remap='I'>fontid</emphasis>: FONTID
2268 <emphasis remap='I'>info</emphasis>: XFONTINFO
2272 <function>Font</function>,
2273 <function>Alloc</function>
2276 This request returns the font header and property information
2277 for the open font associated with FONTID.
2281 If FONTID is not associated with any open fonts, a
2282 <function> Font </function>
2290 <!-- .IN "QueryXExtents8" "" "@DEF@" -->
2291 <function>QueryXExtents8</function>
2296 <emphasis remap='I'>fontid</emphasis>: FONTID
2299 <emphasis remap='I'>range</emphasis>: BOOL
2303 <emphasis remap='I'>chars</emphasis>: STRING8
2311 <emphasis remap='I'>extents</emphasis>: LISTofXCHARINFO
2315 <function>Font</function>,
2316 <function>Range</function>,
2317 <function>Alloc</function>
2320 This request is equivalent to
2321 <function>QueryXExtents16 </function>
2323 uses 1-byte character codes.
2329 <!-- .IN "QueryXExtents16" "" "@DEF@" -->
2330 <function>QueryXExtents16</function>
2334 <emphasis remap='I'>fontid</emphasis>: FONTID
2338 <emphasis remap='I'>range</emphasis>: BOOL
2342 <emphasis remap='I'>chars</emphasis>: LISTofCHAR2B
2350 <emphasis remap='I'>extents</emphasis>: LISTofXCHARINFO
2354 <function>Font</function>,
2355 <function>Range</function>,
2356 <function>Alloc</function>
2359 This request returns a list of glyph extents from the open
2360 font associated with FONTID for the series of characters
2361 specified by RANGE and CHARS.
2365 If RANGE is True, each succeeding pair of elements in CHARS is
2366 treated as a range of characters for which extents should be
2367 returned. If CHARS contains an odd number of elements, the
2368 font's XFONTINFO.CHAR-RANGE.MAX-CHAR is implicitly appended to
2369 the list. If CHARS contains no elements, the list is
2370 implicitly replaced with the font's XFONTINFO.CHAR-RANGE. If
2371 any of the resulting character ranges are invalid, a Range
2372 error is returned. Otherwise, the character ranges are
2373 concatenated in the order given by CHARS to produce a set of
2374 character codes for which extents are returned.
2378 If RANGE is False, then CHARS specifies the set of character
2379 codes for which extents are returned. If CHARS is of
2380 zero length, then a zero-length list of extents is returned.
2384 The extents for each character code in the resulting set (which
2385 may contain duplicates) are returned in the order in
2386 which the character codes appear in the set.
2387 At least one metric for each character shall be non-zero
2388 unless the character is not encoded in the font, in which case
2389 all-zero metrics are returned.
2390 A blank, zero-width character can be encoded
2391 with non-zero but equal left and right bearings.
2395 If FONTID is not associated with any open fonts, a
2396 <function>Font</function>
2398 returned. If RANGE is True and CHARS contains any invalid
2400 <function>Range</function>
2407 <!-- .IN "QueryXBitmaps8" "" "@DEF@" -->
2408 <function>QueryXBitmaps8</function>
2413 <emphasis remap='I'>fontid</emphasis>: FONTID
2416 <emphasis remap='I'>range</emphasis>: BOOL
2419 <emphasis remap='I'>chars</emphasis>: STRING8
2422 <emphasis remap='I'>format</emphasis>: BITMAPFORMAT
2431 <emphasis remap='I'>replies-following-hint</emphasis>: CARD32
2435 <emphasis remap='I'>offsets</emphasis>: LISTofOFFSET32
2439 <emphasis remap='I'>bitmaps</emphasis>: LISTofBYTE
2443 <function>Font</function>,
2444 <function>Range</function>,
2445 <function>Format</function>,
2446 <function>Alloc</function>
2449 This request is equivalent to
2450 <function>QueryXBitmaps16 </function>
2452 uses 1-byte character codes.
2457 <!-- .IN "QueryXBitmaps16" "" "@DEF@" -->
2458 <function>QueryXBitmaps16</function>
2463 <emphasis remap='I'>fontid</emphasis>: FONTID
2467 <emphasis remap='I'>range</emphasis>: BOOL
2471 <emphasis remap='I'>chars</emphasis>: LISTofCHAR2B
2475 <emphasis remap='I'>format</emphasis>: BITMAPFORMAT
2483 <emphasis remap='I'>replies-following-hint</emphasis>: CARD32
2487 <emphasis remap='I'>offsets</emphasis>: LISTofOFFSET32
2491 <emphasis remap='I'>bitmaps</emphasis>: LISTofBYTE
2495 <function>Font</function>,
2496 <function>Range</function>,
2497 <function>Format</function>,
2498 <function>Alloc</function>
2501 This request returns a list of glyph bitmaps from the open
2502 font associated with FONTID for the series of characters
2503 specified by RANGE and CHARS.
2507 If RANGE is True, each succeeding pair of elements in CHARS is
2508 treated as a range of characters for which bitmaps should be
2509 returned. If CHARS contains an odd number of elements, the
2510 font's XFONTINFO.CHAR-RANGE.MAX-CHAR is implicitly appended to
2511 the list. If CHARS contains no elements, the list is
2512 implicitly replaced with the font's XFONTINFO.CHAR-RANGE. If
2513 any of the resulting character ranges are invalid, a Range
2514 error is returned. Otherwise, the character ranges are
2515 concatenated in the order given by CHARS to produce a set of
2516 character codes for which bitmaps are returned.
2520 If RANGE is False, then CHARS specifies the set of character
2521 codes for which bitmaps are returned. If CHARS is of zero
2522 length, then a single reply containing a zero-length list of
2523 offsets and bitmaps is returned.
2527 If any of the resulting character ranges are invalid, a Range
2528 error is returned. Otherwise, the resulting character ranges
2529 are concatenated in the order given by CHARS to produce a set
2530 of character codes for which bitmaps are returned.
2534 The server is free to return the glyph bitmaps in multiple
2535 replies to reduce the amount of buffering that is necessary.
2536 In this situation, the set of characters obtained above is
2537 partitioned into an implementation-dependent number of
2538 ordered, non-overlapping subsets containing runs of one or
2539 more consecutive characters. The global ordering of
2540 characters must be maintained such that concatenating the
2541 subsets in order that they were produced yields the original
2542 set. A reply is generated for each subset, in the order that
2547 For each character in a subset, an image of that character's
2548 glyph is described by a rectangle of bits corresponding to the
2549 pixels specified by FORMAT.IMAGE-RECT. Within the image, set
2550 and clear bits represent inked and non-inked pixels,
2555 Each scanline of a glyph image, from top to bottom, is zero-padded
2556 on the right to a multiple of the number of bits specified by
2557 FORMAT.SCANLINE-PAD. The scanline is then divided from left
2558 to right into a sequence of FORMAT.SCANLINE-UNIT bits. The
2559 bits of each unit are then arranged such that the left-most
2560 pixel is stored in the most- or least-significant bit,
2561 according to FORMAT.BIT-ORDER-MSB. The bytes of each unit are
2562 then arranged such that the most- or least-significant byte,
2563 according to FORMAT.BYTE-ORDER-MSB, is transmitted first.
2564 Finally, the units are arranged such that the left-most is
2565 transmitted first and the right-most is transmitted last.
2569 The individual images within a subset are then concatenated in
2570 a server-dependent order to form the BITMAPS data of the
2571 reply. If a glyph image is duplicated within a reply, the
2572 server is free to return fewer (but at least one) copies of
2573 the image. If a character is not encoded within the font, a
2574 zero-length bitmap is substituted for this character. Each
2575 glyph image must begin at a bit position that is a multiple of
2576 the FORMAT.SCANLINE-UNIT.
2580 The OFFSETS array in a reply contains one entry for each
2581 character in the subset being returned, in the order that the
2582 characters appear in the subset. Each entry specifies the
2583 starting location in bytes and size in bytes of the
2584 corresponding glyph image in the BITMAPS data of that reply
2585 (i.e. an offset may not refer to data in another reply).
2589 The REPLIES-FOLLOWING-HINT field in all but the last reply
2590 contains a positive value that specifies the number of replies
2591 that are likely, but not required, to follow. In the last
2592 reply, which may contain data for zero or more characters,
2593 this field is set to zero.
2597 If FONTID is not associated with any open fonts, a Font error
2598 is returned. If RANGE is True and CHARS contains any invalid
2599 ranges, a Range error is returned. If FORMAT is invalid, a
2600 Format error is returned.
2605 <!-- .IN "CloseFont" "" "@DEF@" -->
2606 <function>CloseFont</function>
2611 <emphasis remap='I'>fontid</emphasis>: FONTID
2615 <function>Font</function>,
2616 <function>Alloc</function>
2619 This request indicates that the specified FONTID should no
2620 longer be associated with an open font. The server is free to
2621 release any client-specific storage or licenses allocated for
2622 the font. The client may reuse the value of FONTID in a
2624 <function>OpenBitmapFont </function>
2629 If FONTID is not associated with any open fonts, a
2630 <function> Font </function>
2637 <function>"close connection"</function>
2638 <!-- .IN "close connection" "" "@DEF@" -->
2643 When a connection is closed, a
2644 <function>CloseFont </function>
2645 is done on all fonts
2646 that are open on the connection. In addition, the server is
2647 free to release any storage or licenses allocated on behalf of
2648 the client that made the connection.
2654 <title>Errors</title>
2659 All errors are at least 16 bytes long and contain the following fields:
2663 <emphasis remap='I'>type</emphasis>: CARD8 value of 1
2667 <emphasis remap='I'>error-code</emphasis>: CARD8
2671 <emphasis remap='I'>sequence-number</emphasis>: CARD16
2675 <emphasis remap='I'>length</emphasis>: CARD32
2679 <emphasis remap='I'>timestamp</emphasis>: TIMESTAMP
2683 <emphasis remap='I'>major-opcode</emphasis>: CARD8
2687 <emphasis remap='I'>minor-opcode</emphasis>: CARD8
2691 <emphasis remap='I'>data-or-unused</emphasis>: CARD16
2696 The TYPE field has a value of one. The ERROR-CODE field specifies which error
2697 occurred. Core errors codes are in the range 0 through 127, extension error
2698 codes are in the range 128 through 255. The SEQUENCE-NUMBER field contains the
2699 least significant 16 bits of the sequence number of the request that caused the
2700 error. The LENGTH field specifies the length of the error packet in 4-byte
2701 units and must have a value of at least 4. The TIMESTAMP specifies the server
2702 time when the error occurred. The MAJOR-OPCODE and MINOR-OPCODE (zero for core
2703 requests) fields specify the type of request that generated the error. The
2704 DATA-OR-UNUSED field may be used for 16 bits of error-specific information. If
2705 LENGTH is greater than four, these fields are followed by (LENGTH - 4) * 4
2706 bytes of extra data.
2710 The following errors are defined for the core protocol:
2714 <!-- .IN "Error Codes" "Request" "@DEF@" -->
2715 <function>Request</function>
2720 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2723 This error is generated by any request that has an unknown
2724 combination of major and minor request numbers, or by any
2725 extension request that is issued before a
2726 <function>QueryExtension </function>
2733 <!-- .IN "Error Codes" "Format" "@DEF@" -->
2734 <function>Format</function>
2739 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2742 <emphasis remap='I'>format</emphasis>: BITMAPFORMAT bad format value
2745 This error is generated by the use of an invalid BITMAPFORMAT
2747 <function>OpenBitmapFont</function>,
2748 <function>QueryXBitmaps8</function>, and
2749 <function>QueryXBitmaps16</function>
2751 The value that caused the error is included as extra data.
2757 <!-- .IN "Error Codes" "Font" "@DEF@" -->
2758 <function>Font</function>
2762 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2765 <emphasis remap='I'>fontid</emphasis>: FONTID bad font identifier
2768 This error is generated by an invalid FONTID in the
2769 <function>QueryXInfo</function>,
2770 <function>QueryXExtents8</function>,
2771 <function>QueryXExtents16</function>,
2772 <function>QueryXBitmaps8</function>,
2773 <function>QueryXBitmaps16</function>
2775 <function>CloseFont </function>
2776 requests. The value that caused
2777 the error is included as extra data.
2783 <!-- .IN "Error Codes" "Range" "@DEF@" -->
2784 <function>Range</function>
2789 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2792 <emphasis remap='I'>range</emphasis>: RANGE bad range
2795 This error is generated by an invalid RANGE in the
2796 <function> QueryXExtents8</function>,
2797 <function>QueryXExtents16</function>,
2798 <function>QueryXBitmaps8</function>
2800 <function>QueryXBitmaps16 </function>
2802 value that caused the error is included as extra data.
2807 <!-- .IN "Error Codes" "EventMask" "@DEF@" -->
2808 <function>EventMask</function>
2813 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2817 <emphasis remap='I'>event-mask</emphasis>: EVENTMASK bad event mask
2820 This error is generated by an invalid EVENTMASK in the
2821 <function>SetEventMask </function>
2822 request. The value that caused the error is
2823 included as extra data.
2828 <!-- .IN "Error Codes" "AccessContext" "@DEF@" -->
2829 <function>AccessContext</function>
2834 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2837 <emphasis remap='I'>ac</emphasis>: ACCESSCONTEXT unaccepted
2838 <function>AccessContext</function>
2841 This error is generated by an invalid ACCESSCONTEXT in the
2842 <function>FreeAC </function>
2844 <function>SetAuthorization </function>
2846 <function>OpenBitmapFont</function>
2847 request performed without sufficient authorization. In the
2848 first two cases, the ACCESSCONTEXT of the errant request is
2849 returned as extra data. In the third case, the current
2850 ACCESSCONTEXT is returned as extra data.
2855 <!-- .IN "Error Codes" "IDChoice" "@DEF@" -->
2856 <function>IDChoice</function>
2861 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2864 <emphasis remap='I'>id</emphasis>: ID bad identifier
2867 This error is generated by an invalid or already associated
2868 ACCESSCONTEXT identifier in a
2869 <function>CreateAC </function>
2870 request or FONTID identifier
2872 <function>OpenBitmapFont </function>
2873 request. The value that caused the error
2874 is included as extra data.
2879 <!-- .IN "Error Codes" "Name" "@DEF@" -->
2880 <function>Name</function>
2885 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2888 This error is generated by a font name pattern that matches
2890 <function>OpenBitmapFont </function>
2891 request or no catalogue names in a
2892 <function>SetCatalogues </function>
2899 <!-- .IN "Error Codes" "Resolution" "@DEF@" -->
2900 <function>Resolution</function>
2905 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 X value of errant resolution
2909 <emphasis remap='I'>y-resolution</emphasis>: CARD16 Y value of errant resolution
2913 <emphasis remap='I'>point-size</emphasis>: CARD16 point size of errant resolution
2916 This error is generated in response to an invalid RESOLUTION
2918 <function>SetResolution </function>
2919 request. The value that caused the
2920 error is included in the DATA-OR-UNUSED field and as extra data.
2926 <!-- .IN "Error Codes" "Alloc" "@DEF@" -->
2927 <function>Alloc</function>
2932 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2935 This error is generated by any request for which the server
2936 lacks sufficient resources (especially memory).
2942 <!-- .IN "Error Codes" "Length" "@DEF@" -->
2943 <function>Length</function>
2948 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2951 <emphasis remap='I'>length</emphasis>: CARD32 bad length value
2954 This error is generated by any request that has a length field
2955 greater than (MAXIMUM-REQUEST-LENGTH * 4) bytes. The value that
2956 caused the error is included as extra data.
2961 <!-- .IN "Error Codes" "Implementation" "@DEF@" -->
2962 <function>Implementation</function>
2967 <emphasis remap='I'>data-or-unused</emphasis>: CARD16 unused
2970 This error may be generated in response to any request that
2971 the server is unable to process because it is deficient. Use
2972 of this error is highly discouraged and indicates lack of
2973 conformance to the protocol.
2975 Additional errors may be defined by extensions.
2981 <title>Events</title>
2987 Events may be generated in response to requests or at the server's discretion
2988 after the initial connection setup information has been exchanged. Each event
2989 is at least 12 bytes long and contains the following fields:
2993 <!-- .TA .75i .75i .75i .75i -->
2994 <emphasis remap='I'>type</emphasis>: CARD8 value of 2
2998 <emphasis remap='I'>event-code</emphasis>: CARD8
3002 <emphasis remap='I'>sequence-number</emphasis>: CARD16
3006 <emphasis remap='I'>length</emphasis>: CARD32
3010 <emphasis remap='I'>timestamp</emphasis>: TIMESTAMP
3015 The TYPE field contains the value 2. The EVENT-CODE field specifies the number
3016 of the event and is in the range 0-127 for core events or the range 128-255 for
3017 extensions. The SEQUENCE-NUMBER field specifies the least significant 16 bits
3018 of the sequence number of the last request to have been processed by the
3019 server. The LENGTH field specifies the number of 4-byte units in this event
3020 packet and must always have a value of at least 3. The TIMESTAMP field
3021 specifies the server time when the event occurred. If LENGTH is greater than
3022 three, these fields are followed by (LENGTH - 3) * 4 bytes of additional data.
3026 Events are described using the following syntax:
3028 <literallayout class="monospaced">
3029 <function>EventName</function>
3030 <emphasis remap='I'>arg1</emphasis>: type1
3032 <emphasis remap='I'>argN</emphasis>: typeN
3038 If an event does not provide any extra arguments, the
3039 <emphasis remap='I'>arg1</emphasis>...<emphasis remap='I'>argN</emphasis>
3040 lines are omitted from the description.
3044 The core X Font Service protocol defines the following events:
3048 <!-- .IN "KeepAlive" "" "@DEF@" -->
3049 <function>KeepAlive</function>
3053 This unsolicited, nonmaskable event may be sent by the
3054 server to verify that the connection has not been broken
3055 (for transports that do not provide this information).
3056 Clients should acknowledge receipt of this request
3057 by sending any request (such as
3058 <function>NoOp</function>
3065 <!-- .IN "CatalogueListNotify" "" "@DEF@" -->
3066 <function>CatalogueListNotify</function>
3070 <emphasis remap='I'>added</emphasis>: BOOL
3073 <emphasis remap='I'>deleted</emphasis>: BOOL
3076 This event is sent to clients that have included
3077 <function>CatalogueListChangeMask </function>
3078 in their core event mask
3079 whenever the list of catalogues that are available has
3080 changed. The ADDED field is True if new catalogues have
3081 been added to the server, otherwise it is False. The
3082 DELETED field is True if any existing catalogues have
3083 been removed from the server, otherwise it is False.
3088 <!-- .IN "FontListNotify" "" "@DEF@" -->
3089 <function>FontListNotify</function>
3093 <emphasis remap='I'>added</emphasis>: BOOL
3097 <emphasis remap='I'>deleted</emphasis>: BOOL
3100 This event is sent to clients that have included
3101 <function>FontListChangeMask </function>
3102 in their event mask whenever the
3103 list of fonts that are provided by the currently selected
3104 catalogues has changed. The ADDED field is True if new
3105 fonts have been added to any of the catalogues currently
3106 used by the client, otherwise it is False. The DELETED
3107 field is True if any existing fonts have been removed
3108 from any of catalogues used by the client, otherwise it
3113 Additional events may be defined by extensions.
3119 <sect1 id='Protocol_Encoding'>
3120 <title>Protocol Encoding</title>
3122 <!-- (SN Protocol Encoding -->
3126 Numbers that are prefixed with "#x" are in hexadecimal (base 16). All other
3127 numbers are in decimal. Requests, replies, errors, events, and compound types
3128 are described using the syntax:
3131 <literallayout class="monospaced">
3134 <emphasis remap='I'>count</emphasis> <emphasis remap='I'>contents</emphasis> <emphasis remap='I'>name</emphasis>
3136 <emphasis remap='I'>count</emphasis> <emphasis remap='I'>contents</emphasis> <emphasis remap='I'>name</emphasis>
3141 where COUNT is the number of bytes in the data stream occupied by this
3142 field, CONTENTS is the name of the type as given in Section 4 or the value if
3143 this field contains a constant, and NAME is a description of this field.
3147 Objects containing counted lists use a lowercase single-letter variable (whose
3148 scope is limited to the request, reply, event, or error in which it is found)
3149 to represent the number of objects in the list. These variables, and any
3150 expressions in which they are used, should be treated as unsigned integers.
3151 Multiple copies of an object are indicated by CONTENTS prefix "LISTof".
3155 Unused bytes (whose value is undefined) will have a blank CONTENTS field and a
3156 NAME field of "unused". Zeroed bytes (whose value must be zero) will have a
3157 blank CONTENTS field and a NAME field of "zero". The expression pad(e)
3158 refers to the number of bytes needed to round a value "e" up to the closed
3162 <literallayout class="monospaced">
3164 pad(e) = (4 - (e mod 4)) mod 4
3167 <sect2 id='Data_Types_2'>
3168 <title>Data Types</title>
3170 <!-- (SN Data Types -->
3173 <literallayout class="monospaced">
3176 4 CARD32 access context with at least one of the following bits set:
3180 but none of the following bits set:
3189 p unused, p=pad(n+2)
3203 4 CARD32 value, union of the following bits:
3204 #x00000001 ByteOrderMSB
3205 #x00000002 BitOrderMSB
3206 #x00000000 ImageRectMin
3207 #x00000004 ImageRectMaxWidth
3208 #x00000008 ImageRectMax
3209 #x00000000 ScanlinePad8
3210 #x00000100 ScanlinePad16
3211 #x00000200 ScanlinePad32
3212 #x00000300 ScanlinePad64
3213 #x00000000 ScanlineUnit8
3214 #x00001000 ScanlineUnit16
3215 #x00002000 ScanlineUnit32
3216 #x00003000 ScanlineUnit64
3218 except for the following bits which must be zero:
3222 and the following of which at most one bit may be set:
3224 #x0000000c at most one bit can be set
3229 4 CARD32 value, mask of the following bits:
3231 #x00000001 ByteOrderMask
3232 #x00000002 BitOrderMask
3233 #x00000004 ImageRectMask
3234 #x00000008 ScanlinePadMask
3235 #x00000010 ScanlineUnitMask
3237 except for the following bits which must be zero:
3243 1 BOOL boolean, one of the following values:
3248 1 BYTE unsigned byte of data
3251 1 CARD8 8-bit unsigned integer
3254 2 CARD16 16-bit unsigned integer
3257 4 CARD32 32-bit unsigned integer
3265 for core events, this is union of the following bits:
3267 #00000001 CatalogueListChangeMask
3268 #00000002 FontListChangeMask
3270 but none of the following bits set:
3274 extensions define their own sets of bits
3278 4 CARD32 font identifier with at least one of
3279 the following bits set:
3283 but none of the following bits set:
3288 1 INT8 8-bit signed integer
3291 2 INT16 16-bit signed integer
3294 4 INT32 32-bit signed integer
3297 4 CARD32 position (or integer value)
3301 4 n number of PROPOFFSET components
3302 4 m number of bytes of property data
3303 20*n PROPOFFSET property offsets into data block
3304 m LISTofBYTE property data block
3307 8 OFFSET32 name in data block
3308 8 OFFSET32 value in data block
3310 1 CARD8 type, one of the following values:
3317 2 CHAR2B minimum character code
3318 2 CHAR2B maximum character code
3321 2 CARD16 x resolution in pixels per inch
3322 2 CARD16 y resolution in pixels per inch
3323 2 CARD16 point size in decipoints
3330 n LISTofBYTE array of 8-bit character values
3333 4 CARD32 milliseconds since server time origin
3336 2 INT16 left bearing
3337 2 INT16 right bearing
3344 4 CARD32 flags, union of the following bits:
3345 #x00000001 AllCharactersExist
3346 #x00000002 InkInside
3347 #x00000004 HorizontalOverlap
3349 but none of the following bits set:
3352 4 RANGE range of characters in font
3353 1 CARD8 drawing direction
3357 2 CHAR2B default character
3358 12 XCHARINFO minimum bounds
3359 12 XCHARINFO maximum bounds
3361 2 INT16 font descent
3362 n PROPINFO property data
3366 <sect2 id='Requests_2'>
3367 <title>Requests</title>
3368 <para><emphasis role="bold">open connection</emphasis></para>
3369 <literallayout class="monospaced">
3370 1 BYTE byteorder, one of the values:
3371 #x42 MostSignificant Byte first
3372 #x6c LeastSignificant Byte first
3373 1 CARD8 numberof auth in auth-data
3374 2 2 client-major-protocol-version
3375 2 0 client-minor-protocol-version
3376 2 a/4 lengthof auth-data
3377 a LISTofAUTH auth-data
3386 1 CARD8 numberof alternate-servers-hint
3387 1 CARD8 authorization-index
3388 2 a/4 lengthof alternate-servers-hint
3389 2 (d+q)/4 lengthof authorization-data
3390 a LISTofALTERNATESERVER alternate-servers-hint
3391 d LISTofBYTE authorization-data
3396 If STATUS is Busy or Denied, the protocol stops and the connection is
3397 closed. If STATUS is Continue, the client is expected to respond with
3398 additional data, to which the server responds with
3399 a new status value and more data. This dialog continues until the status
3400 is set to Success, or until the server sets STATUS to Busy or Denied
3401 and closes the connection:
3404 <literallayout class="monospaced">
3407 d LISTofBYTE more-authorization-data
3417 d LISTofBYTE more-authorization-data
3421 When STATUS is Success, the protocol resumes with the following
3425 <literallayout class="monospaced">
3426 4 3+(v+w)/4 length of rest of data
3427 2 CARD16 maximum-request-length
3428 2 v length of vendor string
3429 4 CARD32 release-number
3430 v STRING8 vendor-string
3434 Once the connection has been established, the client may send the
3438 <literallayout class="monospaced">
3439 <emphasis role="bold">NoOp</emphasis>
3444 <emphasis role="bold">ListExtensions</emphasis>
3450 1 CARD8 numberof names
3451 2 CARD16 sequence-number
3453 n LISTofSTRNAME names
3456 <emphasis role="bold">QueryExtension</emphasis>
3465 2 CARD16 sequence-number
3467 2 CARD16 major-version
3468 2 CARD16 minor-version
3469 1 CARD8 major-opcode
3471 1 CARD8 number-events
3473 1 CARD8 number-errors
3476 <emphasis role="bold">ListCatalogues</emphasis>
3481 2 n length of pattern
3488 2 CARD16 sequence-number
3490 4 CARD32 replies-following-hint
3491 4 CARD32 numberof catalogue-names
3492 n LISTofSTRNAME catalogue-names
3495 <emphasis role="bold">SetCatalogues</emphasis>
3497 1 CARD8 numberof catalogue-names
3499 n LISTofSTRNAME catalogue-names
3502 <emphasis role="bold">GetCatalogues</emphasis>
3508 1 CARD8 numberof catalogue-names
3509 2 CARD16 sequence-number
3511 n LISTofSTRNAME catalogue-names
3514 <emphasis role="bold">SetEventMask</emphasis>
3516 1 CARD8 extension-opcode
3518 4 EVENTMASK event-mask
3520 <emphasis role="bold">GetEventMask</emphasis>
3522 1 CARD8 extension-opcode
3527 2 CARD16 sequence-number
3529 4 EVENTMASK event-mask
3531 <emphasis role="bold">CreateAC</emphasis>
3533 1 CARD8 numberof authorization-protocols
3536 a LISTofAUTH authorization-protocols
3539 1 CARD8 authorization-index
3540 2 CARD16 sequence-number
3548 d LISTofBYTE authorization-data
3553 If STATUS is Continue, the client is expected to respond with additional
3554 data, to which the server
3555 responds with a new status value and more data. This dialog continues
3556 until the status is set to
3557 Success, Busy, or Denied at which point the request is finished.
3560 <literallayout class="monospaced">
3563 d LISTofBYTE more-authorization-data
3573 d LISTofBYTE authorization-data
3576 <emphasis role="bold">FreeAC</emphasis>
3582 <emphasis role="bold">SetAuthorization</emphasis>
3588 <emphasis role="bold">SetResolution</emphasis>
3590 1 n number of resolutions
3591 2 1+(6*n+p)/4 length
3592 6*n LISTofRESOLUTION resolutions
3595 <emphasis role="bold">GetResolution</emphasis>
3601 1 n number of resolutions
3602 2 CARD16 sequence-number
3603 4 2+(6*n+p)/4 length
3604 6*n LISTofRESOLUTION resolutions
3607 <emphasis role="bold">ListFonts</emphasis>
3612 2 n length of pattern
3619 2 CARD16 sequence-number
3621 4 CARD32 replies-following-hint
3622 4 CARD32 numberof font-names
3623 n LISTofSTRNAME font-names
3626 <emphasis role="bold">ListFontsWithXInfo</emphasis>
3631 2 n length of pattern
3635 =>+(except for last in series)
3638 2 CARD16 sequence-number
3639 4 3+(n+p+f)/4 length
3640 4 CARD32 replies-hint
3641 f XFONTINFO fontinfo
3646 1 0 last-reply indicator
3647 2 CARD16 sequence-number
3650 <emphasis role="bold">OpenBitmapFont</emphasis>
3655 4 BITMAPFORMATMASK format-mask
3656 4 BITMAPFORMAT format
3661 1 BOOL otherid-valid
3662 2 CARD16 sequence-number
3668 <emphasis role="bold">QueryXInfo</emphasis>
3676 2 CARD16 sequence-number
3678 f XFONTINFO fontinfo
3681 <emphasis role="bold">QueryXExtents8</emphasis>
3686 4 n number chars entries
3692 2 CARD16 sequence-number
3694 4 n number of extents
3695 12*n LISTofXCHARINFO extents
3697 <emphasis role="bold">QueryXExtents16</emphasis>
3700 2 3+(2*n+p)/4 length
3702 4 n number chars entries
3703 2*n LISTofCHAR2B chars
3704 p unused, p=pad(2*n)
3708 2 CARD16 sequence-number
3710 4 n number of extents
3711 12*n LISTofXCHARINFO extents
3713 <emphasis role="bold">QueryXBitmaps8</emphasis>
3718 4 BITMAPFORMAT format
3719 4 n number of chars entries
3725 2 CARD16 sequence-number
3726 4 5+2*n+(m+p)/4 length
3727 4 CARD32 replies-following-hint
3728 4 n number of offsets
3729 4 m number of bytes of glyph images
3730 8*n LISTofOFFSET32 offsets
3731 m LISTofBYTE glyphimages
3734 <emphasis role="bold">QueryXBitmaps16</emphasis>
3737 2 4+(2*n+p)/4 length
3739 4 BITMAPFORMAT format
3740 4 n number of chars entries
3741 2*n LISTofCHAR2B chars
3742 p unused, p=pad(2*n)
3746 2 CARD16 sequence-number
3747 4 5+2*n+(m+p)/4 length
3748 4 CARD32 replies-following-hint
3749 4 n number of offsets
3750 4 m number of bytes of glyph images
3751 8*n LISTofOFFSET32 offsets
3752 m LISTofBYTE glyphimages
3755 <emphasis role="bold">CloseFont</emphasis>
3763 <sect2 id='Errors_2'>
3764 <title>Errors</title>
3765 <literallayout class="monospaced">
3767 <emphasis role="bold">Request</emphasis>
3770 2 CARD16 sequence-number
3772 4 TIMESTAMP timestamp
3773 1 CARD8 major-opcode
3774 1 CARD8 minor-opcode
3777 <emphasis role="bold">Format</emphasis>
3780 2 CARD16 sequence-number
3782 4 TIMESTAMP timestamp
3783 1 CARD8 major-opcode
3784 1 CARD8 minor-opcode
3786 4 BITMAPFORMAT bad-format
3788 <emphasis role="bold">Font</emphasis>
3791 2 CARD16 sequence-number
3793 4 TIMESTAMP timestamp
3794 1 CARD8 major-opcode
3795 1 CARD8 minor-opcode
3799 <emphasis role="bold">Range</emphasis>
3802 2 CARD16 sequence-number
3804 4 TIMESTAMP timestamp
3805 1 CARD8 major-opcode
3806 1 CARD8 minor-opcode
3810 <emphasis role="bold">EventMask</emphasis>
3813 2 CARD16 sequence-number
3815 4 TIMESTAMP timestamp
3816 1 CARD8 major-opcode
3817 1 CARD8 minor-opcode
3819 4 EVENTMASK event-mask
3821 <emphasis role="bold">AccessContext</emphasis>
3824 2 CARD16 sequence-number
3826 4 TIMESTAMP timestamp
3827 1 CARD8 major-opcode
3828 1 CARD8 minor-opcode
3830 4 ACCESSCONTEXT access context
3832 <emphasis role="bold">IDChoice</emphasis>
3835 2 CARD16 sequence-number
3837 4 TIMESTAMP timestamp
3838 1 CARD8 major-opcode
3839 1 CARD8 minor-opcode
3843 <emphasis role="bold">Name</emphasis>
3846 2 CARD16 sequence-number
3848 4 TIMESTAMP timestamp
3849 1 CARD8 major-opcode
3850 1 CARD8 minor-opcode
3853 <emphasis role="bold">Resolution</emphasis>
3856 2 CARD16 sequence-number
3858 4 TIMESTAMP timestamp
3859 1 CARD8 major-opcode
3860 1 CARD8 minor-opcode
3861 6 RESOLUTION resolution
3863 <emphasis role="bold">Alloc</emphasis>
3866 2 CARD16 sequence-number
3868 4 TIMESTAMP timestamp
3869 1 CARD8 major-opcode
3870 1 CARD8 minor-opcode
3873 <emphasis role="bold">Length</emphasis>
3876 2 CARD16 sequence-number
3878 4 TIMESTAMP timestamp
3879 1 CARD8 major-opcode
3880 1 CARD8 minor-opcode
3884 <emphasis role="bold">Implementation</emphasis>
3887 2 CARD16 sequence-number
3889 4 TIMESTAMP timestamp
3890 1 CARD8 major-opcode
3891 1 CARD8 minor-opcode
3897 <sect2 id='Events_2'>
3898 <title>Events</title>
3899 <literallayout class="monospaced">
3900 <emphasis role="bold">KeepAlive</emphasis>
3903 2 CARD16 sequence-number
3905 4 TIMESTAMP timestamp
3907 <emphasis role="bold">CatalogueListNotify</emphasis>
3909 1 1 event CatalogueListNotify
3910 2 CARD16 sequence-number
3912 4 TIMESTAMP timestamp
3917 <emphasis role="bold">FontListNotify</emphasis>
3919 1 2 event FontListNotify
3920 2 CARD16 sequence-number
3922 4 TIMESTAMP timestamp
3931 <sect1 id='Acknowledgements'>
3932 <title>Acknowledgements</title>
3934 <!-- (SN Acknowledgements -->
3937 This document represents the culmination of several years of debate and
3938 experiments done under the auspices of the MIT X Consortium font working group.
3939 Although this was a group effort, the author remains responsible for any errors
3940 or omissions. The protocol presented here was primarily designed by Jim
3941 Fulton, Keith Packard, and Bob Scheifler. Special thanks goes to Ned
3942 Batchelder, Jim Flowers, and Axel Deininger for their invigorating comments
3943 which never failed to make this a better document.
3944 Stephen Gildea edited version 2 of this document.
3945 Finally, David Lemke
3946 deserves great credit for designing and coding the sample implementation.
3951 <title>References</title>
3953 All of the following documents are X Consortium standards available from
3957 <title>X Window System Protocol Version 11</title>
3958 <author><firstname>Robert W.</firstname><surname>Scheifler</surname></author>
3962 <title>Adobe System - Bitmap Distribution Format 2.1</title>
3966 <title>X Consortium. X Logical Font Description Conventions, Version 1.5</title>
3971 <appendix id="suggested_licensing_policies">
3972 <title>Suggested Licensing Policies</title>
3974 The authorization data passed by the client in the initial connection
3975 setup information may be used by the font server to implement restrictions
3976 on which fonts may be accessed. Furthermore, the font server is free to
3977 refuse new connections at any time.
3980 Configuration or management of the license restrictions is outside the scope of
3981 the font service protocol and is done in a server-dependent manner. Possible
3982 policies might include, but are not limited to, combinations of the following:
3988 No restrictions - anyone may access any fonts. The server neither
3989 refuses any connections nor generates AccessContext errors on any
3990 fonts. For environments without specially-licensed fonts, this is
3996 Per-machine - only those clients connecting from a known set of
3997 machines are permitted access. The server could get the address
3998 of the connection and look in a list of allowed machines.
4003 Per-user - only a known set of users may access the fonts. The
4004 server can use the authorization data (such as a Kerberos ticket
4005 or a Secure RPC credential) to verify the identity of the user
4006 and then look in a list of allowed users.
4011 Simultaneous Use - only a certain number of clients may use a given
4012 font at any one time. Additional clients would receive AccessContext
4013 errors if they attempt to open the font. This is only effective if
4014 the initial clients keep the font open for the entire time that it
4015 is being used (even if all of the data has been transmitted and is
4021 Postage Meter - a particular font may only be accessed a limited
4022 number of times before its license must be renewed. Each time
4023 the font is opened, the server decrements a counter. When the
4024 counter reaches zero, all further attempts to open the font
4025 return an AccessContext error.
4031 It should be noted that chaining of font servers (obtaining font data from
4032 other font servers) may conflict with certain license policies.
4036 <appendix id="implementation_suggestions">
4037 <title>Implementation Suggestions</title>
4040 Font server implementations will probably wish to use techniques such as the
4041 following to avoid limits on the number of simultaneous connections:
4046 The initial connection information returned by the font
4047 server contains the names of other font servers that
4048 may be used as substitutes. A font server may refuse to
4049 accept a connection, indicating that the client should
4050 try one of the alternatives instead.
4055 On operating systems that support processing forking, font
4056 servers might choose to fork so that the child can continue
4057 processing the existing connections and the parent can accept
4058 new connections. Such implementations are encouraged to use
4059 shared memory so that in-memory font databases can be shared.
4064 On operating systems that support passing stream file descriptors
4065 between processes, cooperating font servers could collect
4066 connections in a single process when there are few connections
4067 and spread them among several processes as the load increases.
4072 If a font client is unable to connect to a server (as opposed
4073 to having the connection terminated), it should retry for an
4074 implementation-dependent length of time (see Xlib's
4075 handling of ECONNREFUSED in XConnDis.c).