Debian Codegraph @

nx-X11/lib/src/xlibi18n/wcWrap.c

raw
1 /*
2
3 Copyright 1991, 1998 The Open Group
4
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
25 from The Open Group.
26
27 */
28
29 /*
30 * Copyright 1991 by the Open Software Foundation
31 *
32 * Permission to use, copy, modify, distribute, and sell this software and its
33 * documentation for any purpose is hereby granted without fee, provided that
34 * the above copyright notice appear in all copies and that both that
35 * copyright notice and this permission notice appear in supporting
36 * documentation, and that the name of Open Software Foundation
37 * not be used in advertising or publicity pertaining to distribution of the
38 * software without specific, written prior permission. Open Software
39 * Foundation makes no representations about the suitability of this
40 * software for any purpose. It is provided "as is" without express or
41 * implied warranty.
42 *
43 * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO
44 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
45 * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE
46 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
47 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
48 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
49 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
50 *
51 * M. Collins OSF
52 */
53
54 #ifdef HAVE_CONFIG_H
55 #include <config.h>
56 #endif
57 #include "Xlibint.h"
58 #include "Xlcint.h"
59
60 void
61 XwcDrawText(
62 Display *dpy,
63 Drawable d,
64 GC gc,
65 int x,
66 int y,
67 XwcTextItem *text_items,
68 int nitems)
69 {
70 register XFontSet fs = NULL;
71 register XwcTextItem *p = text_items;
72 register int i = nitems;
73 register int esc;
74
75 /* ignore leading items with no fontset */
76 while (i && !p->font_set) {
77 i--;
78 p++;
79 }
80
81 for (; --i >= 0; p++) {
82 if (p->font_set)
83 fs = p->font_set;
84 x += p->delta;
85 esc = (*fs->methods->wc_draw_string) (dpy, d, fs, gc, x, y,
86 p->chars, p->nchars);
87 if (!esc)
88 esc = fs->methods->wc_escapement (fs, p->chars, p->nchars);
89 x += esc;
90 }
91 }
92
93 void
94 XwcDrawString(
95 Display *dpy,
96 Drawable d,
97 XFontSet font_set,
98 GC gc,
99 int x,
100 int y,
101 _Xconst wchar_t *text,
102 int text_len)
103 {
104 (void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y,
105 text, text_len);
106 }
107
108 void
109 XwcDrawImageString(
110 Display *dpy,
111 Drawable d,
112 XFontSet font_set,
113 GC gc,
114 int x,
115 int y,
116 _Xconst wchar_t *text,
117 int text_len)
118 {
119 (*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y,
120 text, text_len);
121 }
122
123 int
124 XwcTextEscapement(
125 XFontSet font_set,
126 _Xconst wchar_t *text,
127 int text_len)
128 {
129 return (*font_set->methods->wc_escapement) (font_set, text, text_len);
130 }
131
132 int
133 XwcTextExtents(
134 XFontSet font_set,
135 _Xconst wchar_t *text,
136 int text_len,
137 XRectangle *overall_ink_extents,
138 XRectangle *overall_logical_extents)
139 {
140 return (*font_set->methods->wc_extents) (font_set, text, text_len,
141 overall_ink_extents,
142 overall_logical_extents);
143 }
144
145 Status
146 XwcTextPerCharExtents(
147 XFontSet font_set,
148 _Xconst wchar_t *text,
149 int text_len,
150 XRectangle *ink_extents_buffer,
151 XRectangle *logical_extents_buffer,
152 int buffer_size,
153 int *num_chars,
154 XRectangle *max_ink_extents,
155 XRectangle *max_logical_extents)
156 {
157 return (*font_set->methods->wc_extents_per_char)
158 (font_set, text, text_len,
159 ink_extents_buffer, logical_extents_buffer,
160 buffer_size, num_chars, max_ink_extents, max_logical_extents);
161 }