~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to mi/mipolytext.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/mi/mipolytext.c,v 1.2 2001/08/06 20:51:19 dawes Exp $ */
 
2
/*******************************************************************
 
3
 
 
4
Copyright 1987, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
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
OPEN GROUP 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 Open Group 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 Open Group.
 
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
/* $Xorg: mipolytext.c,v 1.4 2001/02/09 02:05:21 xorgcvs 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
#ifdef HAVE_DIX_CONFIG_H
 
59
#include <dix-config.h>
 
60
#endif
 
61
 
 
62
#include        <X11/X.h>
 
63
#include        <X11/Xmd.h>
 
64
#include        <X11/Xproto.h>
 
65
#include        "misc.h"
 
66
#include        "gcstruct.h"
 
67
#include        <X11/fonts/fontstruct.h>
 
68
#include        "dixfontstr.h"
 
69
#include        "mi.h"
 
70
 
 
71
int
 
72
miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
 
73
    DrawablePtr pDraw;
 
74
    GCPtr       pGC;
 
75
    int         x, y;
 
76
    int         count;
 
77
    char        *chars;
 
78
    FontEncoding fontEncoding;
 
79
{
 
80
    unsigned long n, i;
 
81
    int w;
 
82
    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
 
83
 
 
84
    GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
 
85
              fontEncoding, &n, charinfo);
 
86
    w = 0;
 
87
    for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
 
88
    if (n != 0)
 
89
        (*pGC->ops->PolyGlyphBlt)(
 
90
            pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
 
91
    return x+w;
 
92
}
 
93
 
 
94
 
 
95
int
 
96
miPolyText8(pDraw, pGC, x, y, count, chars)
 
97
    DrawablePtr pDraw;
 
98
    GCPtr       pGC;
 
99
    int         x, y;
 
100
    int         count;
 
101
    char        *chars;
 
102
{
 
103
    unsigned long n, i;
 
104
    int w;
 
105
    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
 
106
 
 
107
    GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
 
108
              Linear8Bit, &n, charinfo);
 
109
    w = 0;
 
110
    for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
 
111
    if (n != 0)
 
112
        (*pGC->ops->PolyGlyphBlt)(
 
113
            pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
 
114
    return x+w;
 
115
}
 
116
 
 
117
 
 
118
int
 
119
miPolyText16(pDraw, pGC, x, y, count, chars)
 
120
    DrawablePtr pDraw;
 
121
    GCPtr       pGC;
 
122
    int         x, y;
 
123
    int         count;
 
124
    unsigned short *chars;
 
125
{
 
126
    unsigned long n, i;
 
127
    int w;
 
128
    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
 
129
 
 
130
    GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
 
131
              (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
 
132
              &n, charinfo);
 
133
    w = 0;
 
134
    for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
 
135
    if (n != 0)
 
136
        (*pGC->ops->PolyGlyphBlt)(
 
137
            pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
 
138
    return x+w;
 
139
}
 
140
 
 
141
 
 
142
int
 
143
miImageText(pDraw, pGC, x, y, count, chars, fontEncoding)
 
144
    DrawablePtr pDraw;
 
145
    GCPtr       pGC;
 
146
    int         x, y;
 
147
    int         count;
 
148
    char        *chars;
 
149
    FontEncoding fontEncoding;
 
150
{
 
151
    unsigned long n, i;
 
152
    FontPtr font = pGC->font;
 
153
    int w;
 
154
    CharInfoPtr charinfo[255];
 
155
 
 
156
    GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
 
157
              fontEncoding, &n, charinfo);
 
158
    w = 0;
 
159
    for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
 
160
    if (n !=0 )
 
161
        (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
 
162
    return x+w;
 
163
}
 
164
 
 
165
 
 
166
void
 
167
miImageText8(pDraw, pGC, x, y, count, chars)
 
168
    DrawablePtr pDraw;
 
169
    GCPtr       pGC;
 
170
    int         x, y;
 
171
    int         count;
 
172
    char        *chars;
 
173
{
 
174
    unsigned long n;
 
175
    FontPtr font = pGC->font;
 
176
    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
 
177
 
 
178
    GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
 
179
              Linear8Bit, &n, charinfo);
 
180
    if (n !=0 )
 
181
        (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
 
182
}
 
183
 
 
184
 
 
185
void
 
186
miImageText16(pDraw, pGC, x, y, count, chars)
 
187
    DrawablePtr pDraw;
 
188
    GCPtr       pGC;
 
189
    int         x, y;
 
190
    int         count;
 
191
    unsigned short *chars;
 
192
{
 
193
    unsigned long n;
 
194
    FontPtr font = pGC->font;
 
195
    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
 
196
 
 
197
    GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
 
198
              (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
 
199
              &n, charinfo);
 
200
    if (n !=0 )
 
201
        (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
 
202
}