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