summaryrefslogtreecommitdiff
path: root/lib/libFS/doc/FSlib.txt
blob: 6d1ee25588d4011bdb8f984aee6da6c6f740672a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
Protocol requests

These functions make protocol requests corresponding to their names.

Connection Setup

FSServer     *
FSOpenServer(
    char       *server);

Creates a connection to the font server specified in the 'server' string.

int
FSCloseServer(
    FSServer     *svr);

Closes the connection to the font server.

Font Manipulation

Font
FSOpenBitmapFont(
    FSServer     *svr,
    fsBitmapFormat hint,
    fsBitmapFormatMask	fmask,
    char       *name,
    Font	*originalid);

Opens the font that matches the given name (which may have '*' and '?'
as wildcards).  The hint contains format information that will probably
be used in subsequent QueryXBitmaps() requests.  The fmask tells which
bits in the mask are valid.  If originalid is non-zero, then the server
already has the font opened under that ID.

int
FSCloseFont(
    FSServer     *svr,
    Font        fid);

Closes the font.

char      **
FSListFonts(
    FSServer     *svr,
    char       *pattern,
    int         maxNames,
    int        *actualCount);

Returns the full names of the fonts matching pattern.  Up to maxNames
names will be returned.  The actual value number be placed in
actualCount.  The return value should be freed with FSFreeFontNames.

int
FSFreeFontNames(
    char    **list);

Frees the list of font names returned by FSListFonts.

char      **
FSListFontsWithXInfo(
    FSServer     *svr,
    char       *pattern,
    int         maxNames,
    int        *actualCount,
    fsFontHeader ***info,
    fsPropInfo ***pprops,
    fsPropOffset ***offsets,
    unsigned char ***prop_data);

Returns the full names of the fonts matching pattern.  Up to maxNames
names will be returned.  The actual value number be placed in
actualCount, and each font's header and property information will also
be returned.

int
FSQueryXInfo(
    FSServer     *svr,
    Font        fid,
    fsFontHeader *info,
    fsPropInfo	 *props,
    fsPropOffset **offsets,
    unsigned char **prop_data);

Returns the font's header information.

int
FSQueryXExtents8(
    FSServer   *svr,
    Font        fid,
    Bool	range_type,
    unsigned char *str,
    unsigned long str_len,
    fsCharInfo **extents);

int
FSQueryXExtents16(
    FSServer   *svr,
    Font        fid,
    Bool	range_type,
    fsChar2b	*str,
    unsigned long str_len,
    fsCharInfo **extents);

Returns the extents of the given characters.  If 'range_type' is set,
the 'str' is considered a range, otherwise its considered a list of
characters.  A NULL str when range_type is set means that all the
character extents will be returned.

int
FSQueryXBitmaps8(
    FSServer     *svr,
    Font        fid,
    fsBitmapFormat format,
    Bool	range_type,
    unsigned char *str,
    unsined long str_len,
    unsigned long **offsets,
    unsigned char **glyph_data);

int
FSQueryXBitmaps16(
    FSServer     *svr,
    Font        fid,
    fsBitmapFormat format,
    Bool	range_type,
    fsChar2b	*str,
    unsined long str_len,
    unsigned long **offsets,
    unsigned char **glyph_data);

Returns the font's bitmaps in the requested format.  The other arguments
are used as in QueryExtents above.

Extensions

char      **
FSListExtensions(
    FSServer     *svr,
    int        *next);

Lists any extension built into the font server.

Bool
FSQueryExtension(
    FSServer     *svr,
    char       *name,
    int        *major_opcode,
    int        *first_event,
    int        *first_error);

Returns information on the specified extension.

int
FSFreeExtensionList(
    char      **list);

Frees the list returned by FSListExtensions().


Helper functions -- these don't map to protocol requests, but
can make writing a FS client simpler.

Synchronization

FSSync(
    FSServer     *svr,
    Bool        discard);

Flushes the output queue and waits for a reply from the server,
which will flush the server's output queue.

typedef int (*FSSyncHandler)(FSServer *);

FSSyncHandler
FSSynchronize(
    FSServer     *svr,
    int         onoff)

Controls whether the server does every request in synchronous form.

FSSyncHandler
FSSetAfterFunction(
    FSServer     *svr,
    FSSyncHandler func);

Sets the function that will be called after every request.  This
is usually NULL or FSSync().

int
FSFlush(
    FSServer     *svr);

Flushes any queued requests to the font server.

Error Handling

typedef int (* FSErrorHandler)(FSServer *, FSErrorEvent *);

FSErrorHandler
FSSetErrorHandler(
    FSErrorHandler handler);

Changes the error handler to 'handler'.  A NULL value will reset
it to use the default.

typedef int (* FSIOErrorHandler)(FSServer *);

FSIOErrorHandler
FSSetIOErrorHandler(
    FSIOErrorHandler handler);

Changes the I/O error handler to 'handler'.  A NULL value will reset
it to use the default.

Miscellaneous

long
FSMaxRequestSize(
    FSServer     *svr);

Returns the largest request size (in 4 byte quantities) that the
server can handle.

char       *
FSServerName(
    char       *server);

Returns the name that FSlib would use to connect to the server.
Translates a NULL in the value of $FONT_SERVER.