2 * Copyright 1990 Network Computing Devices
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Network Computing Devices not be
9 * used in advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission. Network Computing
11 * Devices makes no representations about the suitability of this software
12 * for any purpose. It is provided "as is" without express or implied
15 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
17 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
18 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
21 * OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Dave Lemke, Network Computing Devices, Inc
33 * font server data structures
36 * font server private storage
39 typedef struct _fs_glyph {
40 struct _fs_glyph *next;
41 } FSGlyphRec, *FSGlyphPtr;
43 typedef struct _fs_font {
46 CharInfoPtr inkMetrics;
48 } FSFontRec, *FSFontPtr;
50 /* FS special data for the font */
51 typedef struct _fs_font_data {
53 int generation; /* FS generation when opened */
54 unsigned long glyphs_to_get; /* # glyphs remaining to be gotten */
56 /* Following data needed in case font needs to be reopened. */
59 fsBitmapFormat format;
60 fsBitmapFormatMask fmask;
63 typedef struct fs_clients_depending {
65 struct fs_clients_depending *next;
66 } FSClientsDependingRec, *FSClientsDependingPtr;
68 /* OpenFont specific data for blocked request */
69 typedef struct _fs_blocked_font {
70 FontPtr pfont; /* must be first for fs_read_glyphs */
72 int state; /* how many of the replies have landed */
74 Bool freeFont; /* free this font on failure */
75 CARD16 queryInfoSequence;
76 CARD16 queryExtentsSequence;
77 CARD16 queryBitmapsSequence;
78 fsBitmapFormat format;
79 FSClientsDependingPtr clients_depending;
82 /* LoadGlyphs data for blocked request */
83 typedef struct _fs_blocked_glyphs {
84 FontPtr pfont; /* must be first for fs_read_glyphs */
85 int num_expected_ranges;
86 fsRange *expected_ranges;
87 FSClientsDependingPtr clients_depending;
90 /* LoadExtents data for blocked request */
91 typedef struct _fs_blocked_extents {
93 fsRange *expected_ranges;
95 unsigned long nextents;
99 /* LoadBitmaps data for blocked request */
100 typedef struct _fs_blocked_bitmaps {
102 fsRange *expected_ranges;
105 unsigned long nglyphs;
108 } FSBlockedBitmapRec;
110 /* state for blocked ListFonts */
111 typedef struct _fs_blocked_list {
115 /* state for blocked ListFontsWithInfo */
116 typedef struct _fs_blocked_list_info {
122 } FSBlockedListInfoRec;
124 /* state for blocked request */
125 typedef struct _fs_block_data {
126 int type; /* Open Font, LoadGlyphs, ListFonts,
128 pointer client; /* who wants it */
129 CARD16 sequenceNumber; /* expected */
130 pointer data; /* type specific data */
131 int errcode; /* Suspended, et al. */
132 struct _fs_block_data *depending; /* clients depending on this one */
133 struct _fs_block_data *next;
136 /* state for reconnected to dead font server */
137 typedef struct _fs_reconnect {
139 } FSReconnectRec, *FSReconnectPtr;
142 #if !defined(UNIXCPP) || defined(ANSICPP)
143 #define fsCat(x,y) x##_##y
145 #define fsCat(x,y) x/**/_/**/y
149 /* copy XCharInfo parts of a protocol reply into a xCharInfo */
151 #define fsUnpack_XCharInfo(packet, structure) \
152 (structure)->leftSideBearing = fsCat(packet,left); \
153 (structure)->rightSideBearing = fsCat(packet,right); \
154 (structure)->characterWidth = fsCat(packet,width); \
155 (structure)->ascent = fsCat(packet,ascent); \
156 (structure)->descent = fsCat(packet,descent); \
157 (structure)->attributes = fsCat(packet,attributes)
160 /* copy XFontInfoHeader parts of a protocol reply into a FontInfoRec */
162 #define fsUnpack_XFontInfoHeader(packet, structure) \
163 (structure)->allExist = ((packet)->font_header_flags & FontInfoAllCharsExist) != 0; \
164 (structure)->drawDirection = \
165 ((packet)->font_header_draw_direction == LeftToRightDrawDirection) ? \
166 LeftToRight : RightToLeft; \
167 (structure)->inkInside = ((packet)->font_header_flags & FontInfoInkInside) != 0; \
169 (structure)->firstRow = (packet)->font_hdr_char_range_min_char_high; \
170 (structure)->firstCol = (packet)->font_hdr_char_range_min_char_low; \
171 (structure)->lastRow = (packet)->font_hdr_char_range_max_char_high; \
172 (structure)->lastCol = (packet)->font_hdr_char_range_max_char_low; \
173 (structure)->defaultCh = (packet)->font_header_default_char_low \
174 + ((packet)->font_header_default_char_high << 8); \
176 (structure)->fontDescent = (packet)->font_header_font_descent; \
177 (structure)->fontAscent = (packet)->font_header_font_ascent; \
179 fsUnpack_XCharInfo((packet)->font_header_min_bounds, &(structure)->minbounds); \
180 fsUnpack_XCharInfo((packet)->font_header_min_bounds, &(structure)->ink_minbounds); \
181 fsUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->maxbounds); \
182 fsUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->ink_maxbounds)
184 extern void _fs_init_fontinfo ( FSFpePtr conn, FontInfoPtr pfi );
185 extern int _fs_convert_props ( fsPropInfo *pi, fsPropOffset *po, pointer pd,
187 extern int _fs_convert_lfwi_reply ( FSFpePtr conn, FontInfoPtr pfi,
188 fsListFontsWithXInfoReply *fsrep,
189 fsPropInfo *pi, fsPropOffset *po,
191 extern int fs_build_range ( FontPtr pfont, Bool range_flag,
192 unsigned int count, int item_size,
193 unsigned char *data, int *nranges,
195 extern void _fs_clean_aborted_loadglyphs ( FontPtr pfont,
196 int num_expected_ranges,
197 fsRange *expected_ranges );
198 extern void _fs_init_font ( FontPtr pfont );
199 extern pointer fs_alloc_glyphs (FontPtr pFont, int size);
200 #endif /* _FSERVESTR_H_ */