]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/font/fc/fservestr.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / lib / font / fc / fservestr.h
1 /* $XConsortium: fservestr.h,v 1.13 95/06/09 22:16:29 gildea Exp $ */
2 /*
3  * Copyright 1990 Network Computing Devices
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of Network Computing Devices not be
10  * used in advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.  Network Computing
12  * Devices makes no representations about the suitability of this software
13  * for any purpose.  It is provided "as is" without express or implied
14  * warranty.
15  *
16  * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
18  * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
19  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
21  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
22  * OR PERFORMANCE OF THIS SOFTWARE.
23  *
24  * Author:      Dave Lemke, Network Computing Devices, Inc
25  */
26
27 #ifndef _FSERVESTR_H_
28 #define _FSERVESTR_H_
29
30 #include        "fserve.h"
31 #include        "fsio.h"
32
33 /*
34  * font server data structures
35  */
36 /*
37  * font server private storage
38  */
39
40
41 typedef struct _fs_font {
42     CharInfoPtr pDefault;
43     CharInfoPtr encoding;
44     CharInfoPtr inkMetrics;
45 }           FSFontRec, *FSFontPtr;
46
47 /* FS special data for the font */
48 typedef struct _fs_font_data {
49     long        fontid;
50     int         generation;     /* FS generation when opened */
51     FontPathElementPtr fpe;
52     unsigned long glyphs_to_get;        /* # glyphs remaining to be gotten */
53
54     /* Following data needed in case font needs to be reopened. */
55     int         namelen;
56     char       *name;
57     fsBitmapFormat      format;
58     fsBitmapFormatMask  fmask;
59 }           FSFontDataRec;
60
61 typedef struct fs_clients_depending {
62     pointer     client;
63     struct fs_clients_depending *next;
64 }       FSClientsDependingRec, *FSClientsDependingPtr;
65
66 /* OpenFont specific data for blocked request */
67 typedef struct _fs_blocked_font {
68     FontPtr     pfont;
69     long        fontid;
70     int         state;          /* how many of the replies have landed */
71     int         errcode;
72     int         flags;
73     fsBitmapFormat format;
74     FSClientsDependingPtr       clients_depending;
75 }           FSBlockedFontRec;
76
77 /* LoadGlyphs data for blocked request */
78 typedef struct _fs_blocked_glyphs {
79     FontPtr     pfont;
80     int         num_expected_ranges;
81     fsRange     *expected_ranges;
82     int         errcode;
83     Bool        done;
84     FSClientsDependingPtr       clients_depending;
85 }           FSBlockedGlyphRec;
86
87 /* LoadExtents data for blocked request */
88 typedef struct _fs_blocked_extents {
89     FontPtr     pfont;
90     fsRange    *expected_ranges;
91     int         nranges;
92     Bool        done;
93     unsigned long nextents;
94     fsXCharInfo *extents;
95 }           FSBlockedExtentRec;
96
97 /* LoadBitmaps data for blocked request */
98 typedef struct _fs_blocked_bitmaps {
99     FontPtr     pfont;
100     fsRange    *expected_ranges;
101     int         nranges;
102     Bool        done;
103     unsigned long size;
104     unsigned long nglyphs;
105     fsOffset32   *offsets;
106     pointer     gdata;
107 }           FSBlockedBitmapRec;
108
109 /* state for blocked ListFonts */
110 typedef struct _fs_blocked_list {
111     FontNamesPtr names;
112     int         patlen;
113     int         errcode;
114     Bool        done;
115 }           FSBlockedListRec;
116
117 /* state for blocked ListFontsWithInfo */
118 typedef struct _fs_blocked_list_info {
119     int         status;
120     char       *name;
121     int         namelen;
122     FontInfoPtr pfi;
123     int         remaining;
124     int         errcode;
125 }           FSBlockedListInfoRec;
126
127 /* state for blocked request */
128 typedef struct _fs_block_data {
129     int                     type;       /* Open Font, LoadGlyphs, ListFonts,
130                                          * ListWithInfo */
131     pointer                 client;         /* who wants it */
132     int                     sequence_number;/* expected */
133     fsGenericReply          header;
134     pointer                 data;           /* type specific data */
135     struct _fs_block_data   *depending;     /* clients depending on this one */
136     struct _fs_block_data   *next;
137 }           FSBlockDataRec;
138
139 /* state for reconnected to dead font server */
140 typedef struct _fs_reconnect {
141     int     i;
142 } FSReconnectRec, *FSReconnectPtr;
143
144
145 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
146 #define fsCat(x,y) x##_##y
147 #else
148 #define fsCat(x,y) x/**/_/**/y
149 #endif
150
151
152 /* copy XCharInfo parts of a protocol reply into a xCharInfo */
153
154 #define fsUnpack_XCharInfo(packet, structure) \
155     (structure)->leftSideBearing = fsCat(packet,left); \
156     (structure)->rightSideBearing = fsCat(packet,right); \
157     (structure)->characterWidth = fsCat(packet,width); \
158     (structure)->ascent = fsCat(packet,ascent); \
159     (structure)->descent = fsCat(packet,descent); \
160     (structure)->attributes = fsCat(packet,attributes)
161
162
163 /* copy XFontInfoHeader parts of a protocol reply into a FontInfoRec */
164
165 #define fsUnpack_XFontInfoHeader(packet, structure) \
166     (structure)->allExist = ((packet)->font_header_flags & FontInfoAllCharsExist) != 0; \
167     (structure)->drawDirection = \
168         ((packet)->font_header_draw_direction == LeftToRightDrawDirection) ? \
169         LeftToRight : RightToLeft; \
170     (structure)->inkInside = ((packet)->font_header_flags & FontInfoInkInside) != 0; \
171  \
172     (structure)->firstRow = (packet)->font_hdr_char_range_min_char_high; \
173     (structure)->firstCol = (packet)->font_hdr_char_range_min_char_low; \
174     (structure)->lastRow = (packet)->font_hdr_char_range_max_char_high; \
175     (structure)->lastCol = (packet)->font_hdr_char_range_max_char_low; \
176     (structure)->defaultCh = (packet)->font_header_default_char_low \
177                            + ((packet)->font_header_default_char_high << 8); \
178  \
179     (structure)->fontDescent = (packet)->font_header_font_descent; \
180     (structure)->fontAscent = (packet)->font_header_font_ascent; \
181  \
182     fsUnpack_XCharInfo((packet)->font_header_min_bounds, &(structure)->minbounds); \
183     fsUnpack_XCharInfo((packet)->font_header_min_bounds, &(structure)->ink_minbounds); \
184     fsUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->maxbounds); \
185     fsUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->ink_maxbounds)
186
187
188 #endif                          /* _FSERVESTR_H_ */