11ab64890Smrg/*
21ab64890Smrg
31ab64890SmrgCopyright 1991, 1998  The Open Group
41ab64890Smrg
51ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its
61ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that
71ab64890Smrgthe above copyright notice appear in all copies and that both that
81ab64890Smrgcopyright notice and this permission notice appear in supporting
91ab64890Smrgdocumentation.
101ab64890Smrg
111ab64890SmrgThe above copyright notice and this permission notice shall be included
121ab64890Smrgin all copies or substantial portions of the Software.
131ab64890Smrg
141ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
151ab64890SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
161ab64890SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
171ab64890SmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
181ab64890SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
191ab64890SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
201ab64890SmrgOTHER DEALINGS IN THE SOFTWARE.
211ab64890Smrg
221ab64890SmrgExcept as contained in this notice, the name of The Open Group shall
231ab64890Smrgnot be used in advertising or otherwise to promote the sale, use or
241ab64890Smrgother dealings in this Software without prior written authorization
251ab64890Smrgfrom The Open Group.
261ab64890Smrg
271ab64890Smrg*/
281ab64890Smrg/*
291ab64890Smrg * Copyright 1991 by the Open Software Foundation
301ab64890Smrg *
311ab64890Smrg * Permission to use, copy, modify, distribute, and sell this software and its
321ab64890Smrg * documentation for any purpose is hereby granted without fee, provided that
331ab64890Smrg * the above copyright notice appear in all copies and that both that
341ab64890Smrg * copyright notice and this permission notice appear in supporting
3561b2299dSmrg * documentation, and that the name of Open Software Foundation
361ab64890Smrg * not be used in advertising or publicity pertaining to distribution of the
371ab64890Smrg * software without specific, written prior permission.  Open Software
381ab64890Smrg * Foundation makes no representations about the suitability of this
391ab64890Smrg * software for any purpose.  It is provided "as is" without express or
401ab64890Smrg * implied warranty.
411ab64890Smrg *
421ab64890Smrg * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO
431ab64890Smrg * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
441ab64890Smrg * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE
4561b2299dSmrg * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
461ab64890Smrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
471ab64890Smrg * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
481ab64890Smrg * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4961b2299dSmrg *
5061b2299dSmrg *		 M. Collins		OSF
5161b2299dSmrg */
521ab64890Smrg
531ab64890Smrg#ifdef HAVE_CONFIG_H
541ab64890Smrg#include <config.h>
551ab64890Smrg#endif
561ab64890Smrg#include "Xlibint.h"
571ab64890Smrg#include "Xlcint.h"
581ab64890Smrg
591ab64890Smrgvoid
601ab64890SmrgXmbDrawText(
611ab64890Smrg    Display            *dpy,
621ab64890Smrg    Drawable            d,
631ab64890Smrg    GC                  gc,
641ab64890Smrg    int                 x,
651ab64890Smrg    int                 y,
661ab64890Smrg    XmbTextItem        *text_items,
671ab64890Smrg    int                 nitems)
681ab64890Smrg{
691ab64890Smrg    register XFontSet fs = NULL;
701ab64890Smrg    register XmbTextItem *p = text_items;
711ab64890Smrg    register int i = nitems;
721ab64890Smrg    register int esc;
731ab64890Smrg
741ab64890Smrg    /* ignore leading items with no fontset */
751ab64890Smrg    while (i && !p->font_set) {
761ab64890Smrg	i--;
771ab64890Smrg	p++;
781ab64890Smrg    }
791ab64890Smrg
801ab64890Smrg    for (; --i >= 0; p++) {
811ab64890Smrg	if (p->font_set)
821ab64890Smrg	    fs = p->font_set;
831ab64890Smrg	x += p->delta;
841ab64890Smrg	esc = (*fs->methods->mb_draw_string) (dpy, d, fs, gc, x, y,
851ab64890Smrg					      p->chars, p->nchars);
861ab64890Smrg	if (!esc)
871ab64890Smrg	    esc = fs->methods->mb_escapement (fs, p->chars, p->nchars);
881ab64890Smrg	x += esc;
891ab64890Smrg    }
901ab64890Smrg}
911ab64890Smrg
921ab64890Smrgvoid
931ab64890SmrgXmbDrawString(
941ab64890Smrg    Display            *dpy,
951ab64890Smrg    Drawable            d,
961ab64890Smrg    XFontSet            font_set,
971ab64890Smrg    GC                  gc,
981ab64890Smrg    int                 x,
991ab64890Smrg    int                 y,
1001ab64890Smrg    _Xconst char       *text,
1011ab64890Smrg    int                 text_len)
1021ab64890Smrg{
1031ab64890Smrg    (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y,
104818534a1Smrg						text, text_len);
1051ab64890Smrg}
1061ab64890Smrg
1071ab64890Smrg
1081ab64890Smrgvoid
1091ab64890SmrgXmbDrawImageString(
1101ab64890Smrg    Display            *dpy,
1111ab64890Smrg    Drawable            d,
1121ab64890Smrg    XFontSet            font_set,
1131ab64890Smrg    GC                  gc,
1141ab64890Smrg    int                 x,
1151ab64890Smrg    int                 y,
1161ab64890Smrg    _Xconst char       *text,
1171ab64890Smrg    int                 text_len)
1181ab64890Smrg{
1191ab64890Smrg    (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y,
120818534a1Smrg						text, text_len);
1211ab64890Smrg}
1221ab64890Smrg
12361b2299dSmrgint
1241ab64890SmrgXmbTextEscapement(
1251ab64890Smrg    XFontSet        font_set,
1261ab64890Smrg    _Xconst char   *text,
1271ab64890Smrg    int             text_len)
1281ab64890Smrg{
129818534a1Smrg    return (*font_set->methods->mb_escapement) (font_set, text, text_len);
1301ab64890Smrg}
1311ab64890Smrg
1321ab64890Smrgint
1331ab64890SmrgXmbTextExtents(
1341ab64890Smrg    XFontSet        font_set,
1351ab64890Smrg    _Xconst char   *text,
1361ab64890Smrg    int             text_len,
1371ab64890Smrg    XRectangle     *overall_ink_extents,
1381ab64890Smrg    XRectangle     *overall_logical_extents)
1391ab64890Smrg{
140818534a1Smrg    return (*font_set->methods->mb_extents) (font_set, text, text_len,
1411ab64890Smrg					     overall_ink_extents,
1421ab64890Smrg					     overall_logical_extents);
1431ab64890Smrg}
1441ab64890Smrg
1451ab64890SmrgStatus
1461ab64890SmrgXmbTextPerCharExtents(
1471ab64890Smrg    XFontSet        font_set,
1481ab64890Smrg    _Xconst char   *text,
1491ab64890Smrg    int             text_len,
1501ab64890Smrg    XRectangle     *ink_extents_buffer,
1511ab64890Smrg    XRectangle     *logical_extents_buffer,
1521ab64890Smrg    int             buffer_size,
1531ab64890Smrg    int            *num_chars,
1541ab64890Smrg    XRectangle     *max_ink_extents,
1551ab64890Smrg    XRectangle     *max_logical_extents)
1561ab64890Smrg{
1571ab64890Smrg    return (*font_set->methods->mb_extents_per_char)
158818534a1Smrg	     (font_set, text, text_len,
1591ab64890Smrg	      ink_extents_buffer, logical_extents_buffer,
1601ab64890Smrg	      buffer_size, num_chars, max_ink_extents, max_logical_extents);
1611ab64890Smrg}
162