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