11ab64890Smrg/*
21ab64890Smrg * Copyright 1992, 1993 by TOSHIBA Corp.
31ab64890Smrg *
41ab64890Smrg * Permission to use, copy, modify, and distribute this software and its
51ab64890Smrg * documentation for any purpose and without fee is hereby granted, provided
61ab64890Smrg * that the above copyright notice appear in all copies and that both that
71ab64890Smrg * copyright notice and this permission notice appear in supporting
81ab64890Smrg * documentation, and that the name of TOSHIBA not be used in advertising
91ab64890Smrg * or publicity pertaining to distribution of the software without specific,
101ab64890Smrg * written prior permission. TOSHIBA make no representations about the
111ab64890Smrg * suitability of this software for any purpose.  It is provided "as is"
121ab64890Smrg * without express or implied warranty.
131ab64890Smrg *
141ab64890Smrg * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
151ab64890Smrg * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
161ab64890Smrg * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
171ab64890Smrg * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
181ab64890Smrg * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
191ab64890Smrg * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
201ab64890Smrg * SOFTWARE.
211ab64890Smrg *
221ab64890Smrg * Author: Katsuhisa Yano	TOSHIBA Corp.
231ab64890Smrg *			   	mopi@osa.ilab.toshiba.co.jp
241ab64890Smrg */
251ab64890Smrg
261ab64890Smrg#ifdef HAVE_CONFIG_H
271ab64890Smrg#include <config.h>
281ab64890Smrg#endif
291ab64890Smrg#include "Xlibint.h"
301ab64890Smrg#include "XomGeneric.h"
311ab64890Smrg
321ab64890Smrg#define GET_VALUE_MASK	(GCFunction | GCForeground | GCBackground | GCFillStyle)
331ab64890Smrg#define SET_VALUE_MASK	(GCFunction | GCForeground | GCFillStyle)
341ab64890Smrg
351ab64890Smrgstatic void
361ab64890Smrg_XomGenericDrawImageString(
371ab64890Smrg    Display *dpy,
381ab64890Smrg    Drawable d,
391ab64890Smrg    XOC oc,
401ab64890Smrg    GC gc,
411ab64890Smrg    int x, int y,
421ab64890Smrg    XOMTextType type,
431ab64890Smrg    XPointer text,
441ab64890Smrg    int length)
451ab64890Smrg{
461ab64890Smrg    XGCValues values;
471ab64890Smrg    XRectangle extent;
481ab64890Smrg
491ab64890Smrg    XGetGCValues(dpy, gc, GET_VALUE_MASK, &values);
501ab64890Smrg
511ab64890Smrg    XSetFunction(dpy, gc, GXcopy);
521ab64890Smrg    XSetForeground(dpy, gc, values.background);
531ab64890Smrg    XSetFillStyle(dpy, gc, FillSolid);
541ab64890Smrg
551ab64890Smrg    _XomGenericTextExtents(oc, type, text, length, 0, &extent);
561ab64890Smrg    XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width,
571ab64890Smrg		   extent.height);
581ab64890Smrg
591ab64890Smrg    XChangeGC(dpy, gc, SET_VALUE_MASK, &values);
601ab64890Smrg
611ab64890Smrg    _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length);
621ab64890Smrg}
631ab64890Smrg
641ab64890Smrgvoid
651ab64890Smrg_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
661ab64890Smrg			   int y, _Xconst char *text, int length)
671ab64890Smrg{
681ab64890Smrg    _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte,
691ab64890Smrg			       (XPointer) text, length);
701ab64890Smrg}
711ab64890Smrg
721ab64890Smrgvoid
731ab64890Smrg_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
741ab64890Smrg			   int y, _Xconst wchar_t *text, int length)
751ab64890Smrg{
761ab64890Smrg    _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar,
771ab64890Smrg			       (XPointer) text, length);
781ab64890Smrg}
791ab64890Smrg
801ab64890Smrgvoid
811ab64890Smrg_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
821ab64890Smrg			     int y, _Xconst char *text, int length)
831ab64890Smrg{
841ab64890Smrg    _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMUtf8String,
851ab64890Smrg			       (XPointer) text, length);
861ab64890Smrg}
87