]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/mi/mipolytext.c
Support RDP5 logon packets.
[rdpsrv] / Xserver / programs / Xserver / mi / mipolytext.c
1 /*******************************************************************
2
3 Copyright (c) 1987  X Consortium
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
25
26
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29                         All Rights Reserved
30
31 Permission to use, copy, modify, and distribute this software and its 
32 documentation for any purpose and without fee is hereby granted, 
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in 
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.  
38
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 SOFTWARE.
46
47 ************************************************************************/
48 /* $XConsortium: mipolytext.c,v 5.4 94/04/17 20:27:45 keith Exp $ */
49 /*
50  * mipolytext.c - text routines
51  *
52  * Author:      haynes
53  *              Digital Equipment Corporation
54  *              Western Software Laboratory
55  * Date:        Thu Feb  5 1987
56  */
57
58 #include        "X.h"
59 #include        "Xmd.h"
60 #include        "Xproto.h"
61 #include        "misc.h"
62 #include        "gcstruct.h"
63 #include        "fontstruct.h"
64 #include        "dixfontstr.h"
65
66 int
67 miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
68     DrawablePtr pDraw;
69     GCPtr       pGC;
70     int         x, y;
71     int         count;
72     char        *chars;
73     FontEncoding fontEncoding;
74 {
75     unsigned long n, i;
76     int w;
77     CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
78
79     GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
80               fontEncoding, &n, charinfo);
81     w = 0;
82     for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
83     if (n != 0)
84         (*pGC->ops->PolyGlyphBlt)(
85             pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
86     return x+w;
87 }
88
89
90 int
91 miPolyText8(pDraw, pGC, x, y, count, chars)
92     DrawablePtr pDraw;
93     GCPtr       pGC;
94     int         x, y;
95     int         count;
96     char        *chars;
97 {
98     unsigned long n, i;
99     int w;
100     CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
101
102     GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
103               Linear8Bit, &n, charinfo);
104     w = 0;
105     for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
106     if (n != 0)
107         (*pGC->ops->PolyGlyphBlt)(
108             pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
109     return x+w;
110 }
111
112
113 int
114 miPolyText16(pDraw, pGC, x, y, count, chars)
115     DrawablePtr pDraw;
116     GCPtr       pGC;
117     int         x, y;
118     int         count;
119     unsigned short *chars;
120 {
121     unsigned long n, i;
122     int w;
123     CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
124
125     GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
126               (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
127               &n, charinfo);
128     w = 0;
129     for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
130     if (n != 0)
131         (*pGC->ops->PolyGlyphBlt)(
132             pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
133     return x+w;
134 }
135
136
137 int
138 miImageText(pDraw, pGC, x, y, count, chars, fontEncoding)
139     DrawablePtr pDraw;
140     GCPtr       pGC;
141     int         x, y;
142     int         count;
143     char        *chars;
144     FontEncoding fontEncoding;
145 {
146     unsigned long n, i;
147     FontPtr font = pGC->font;
148     int w;
149     CharInfoPtr charinfo[255];
150
151     GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
152               fontEncoding, &n, charinfo);
153     w = 0;
154     for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
155     if (n !=0 )
156         (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
157     return x+w;
158 }
159
160
161 void
162 miImageText8(pDraw, pGC, x, y, count, chars)
163     DrawablePtr pDraw;
164     GCPtr       pGC;
165     int         x, y;
166     int         count;
167     char        *chars;
168 {
169     unsigned long n;
170     FontPtr font = pGC->font;
171     CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
172
173     GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
174               Linear8Bit, &n, charinfo);
175     if (n !=0 )
176         (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
177 }
178
179
180 void
181 miImageText16(pDraw, pGC, x, y, count, chars)
182     DrawablePtr pDraw;
183     GCPtr       pGC;
184     int         x, y;
185     int         count;
186     unsigned short *chars;
187 {
188     unsigned long n;
189     FontPtr font = pGC->font;
190     CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
191
192     GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
193               (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
194               &n, charinfo);
195     if (n !=0 )
196         (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
197 }