1/* 2 * Copyright 1992, 1993 by TOSHIBA Corp. 3 * 4 * Permission to use, copy, modify, and distribute this software and its 5 * documentation for any purpose and without fee is hereby granted, provided 6 * that the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation, and that the name of TOSHIBA not be used in advertising 9 * or publicity pertaining to distribution of the software without specific, 10 * written prior permission. TOSHIBA make no representations about the 11 * suitability of this software for any purpose. It is provided "as is" 12 * without express or implied warranty. 13 * 14 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20 * SOFTWARE. 21 * 22 * Author: Katsuhisa Yano TOSHIBA Corp. 23 * mopi@osa.ilab.toshiba.co.jp 24 */ 25 26#ifdef HAVE_CONFIG_H 27#include <config.h> 28#endif 29#include "Xlibint.h" 30#include "XomGeneric.h" 31 32#define GET_VALUE_MASK (GCFunction | GCForeground | GCBackground | GCFillStyle) 33#define SET_VALUE_MASK (GCFunction | GCForeground | GCFillStyle) 34 35static void 36_XomGenericDrawImageString( 37 Display *dpy, 38 Drawable d, 39 XOC oc, 40 GC gc, 41 int x, int y, 42 XOMTextType type, 43 XPointer text, 44 int length) 45{ 46 XGCValues values; 47 XRectangle extent; 48 49 XGetGCValues(dpy, gc, GET_VALUE_MASK, &values); 50 51 XSetFunction(dpy, gc, GXcopy); 52 XSetForeground(dpy, gc, values.background); 53 XSetFillStyle(dpy, gc, FillSolid); 54 55 _XomGenericTextExtents(oc, type, text, length, 0, &extent); 56 XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width, 57 extent.height); 58 59 XChangeGC(dpy, gc, SET_VALUE_MASK, &values); 60 61 _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length); 62} 63 64void 65_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, 66 int y, _Xconst char *text, int length) 67{ 68 _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte, 69 (XPointer) text, length); 70} 71 72void 73_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, 74 int y, _Xconst wchar_t *text, int length) 75{ 76 _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar, 77 (XPointer) text, length); 78} 79 80void 81_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, 82 int y, _Xconst char *text, int length) 83{ 84 _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMUtf8String, 85 (XPointer) text, length); 86} 87