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/* 301ab64890Smrg * Copyright 1991 by the Open Software Foundation 311ab64890Smrg * 321ab64890Smrg * Permission to use, copy, modify, distribute, and sell this software and its 331ab64890Smrg * documentation for any purpose is hereby granted without fee, provided that 341ab64890Smrg * the above copyright notice appear in all copies and that both that 351ab64890Smrg * copyright notice and this permission notice appear in supporting 361ab64890Smrg * documentation, and that the name of Open Software Foundation 371ab64890Smrg * not be used in advertising or publicity pertaining to distribution of the 381ab64890Smrg * software without specific, written prior permission. Open Software 391ab64890Smrg * Foundation makes no representations about the suitability of this 401ab64890Smrg * software for any purpose. It is provided "as is" without express or 411ab64890Smrg * implied warranty. 421ab64890Smrg * 431ab64890Smrg * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO 441ab64890Smrg * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 451ab64890Smrg * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE 4661b2299dSmrg * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 471ab64890Smrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 481ab64890Smrg * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 491ab64890Smrg * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 5061b2299dSmrg * 5161b2299dSmrg * M. Collins OSF 5261b2299dSmrg */ 531ab64890Smrg 541ab64890Smrg#ifdef HAVE_CONFIG_H 551ab64890Smrg#include <config.h> 561ab64890Smrg#endif 571ab64890Smrg#include "Xlibint.h" 581ab64890Smrg#include "Xlcint.h" 591ab64890Smrg 601ab64890Smrgvoid 611ab64890SmrgXwcDrawText( 621ab64890Smrg Display *dpy, 631ab64890Smrg Drawable d, 641ab64890Smrg GC gc, 651ab64890Smrg int x, 661ab64890Smrg int y, 671ab64890Smrg XwcTextItem *text_items, 681ab64890Smrg int nitems) 691ab64890Smrg{ 701ab64890Smrg register XFontSet fs = NULL; 711ab64890Smrg register XwcTextItem *p = text_items; 721ab64890Smrg register int i = nitems; 731ab64890Smrg register int esc; 741ab64890Smrg 751ab64890Smrg /* ignore leading items with no fontset */ 761ab64890Smrg while (i && !p->font_set) { 771ab64890Smrg i--; 781ab64890Smrg p++; 791ab64890Smrg } 801ab64890Smrg 811ab64890Smrg for (; --i >= 0; p++) { 821ab64890Smrg if (p->font_set) 831ab64890Smrg fs = p->font_set; 841ab64890Smrg x += p->delta; 851ab64890Smrg esc = (*fs->methods->wc_draw_string) (dpy, d, fs, gc, x, y, 861ab64890Smrg p->chars, p->nchars); 871ab64890Smrg if (!esc) 881ab64890Smrg esc = fs->methods->wc_escapement (fs, p->chars, p->nchars); 891ab64890Smrg x += esc; 901ab64890Smrg } 911ab64890Smrg} 921ab64890Smrg 931ab64890Smrgvoid 941ab64890SmrgXwcDrawString( 951ab64890Smrg Display *dpy, 961ab64890Smrg Drawable d, 971ab64890Smrg XFontSet font_set, 981ab64890Smrg GC gc, 991ab64890Smrg int x, 1001ab64890Smrg int y, 1011ab64890Smrg _Xconst wchar_t *text, 1021ab64890Smrg int text_len) 1031ab64890Smrg{ 1041ab64890Smrg (void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y, 1051ab64890Smrg text, text_len); 1061ab64890Smrg} 1071ab64890Smrg 1081ab64890Smrgvoid 1091ab64890SmrgXwcDrawImageString( 1101ab64890Smrg Display *dpy, 1111ab64890Smrg Drawable d, 1121ab64890Smrg XFontSet font_set, 1131ab64890Smrg GC gc, 1141ab64890Smrg int x, 1151ab64890Smrg int y, 1161ab64890Smrg _Xconst wchar_t *text, 1171ab64890Smrg int text_len) 1181ab64890Smrg{ 1191ab64890Smrg (*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y, 1201ab64890Smrg text, text_len); 1211ab64890Smrg} 1221ab64890Smrg 12361b2299dSmrgint 1241ab64890SmrgXwcTextEscapement( 1251ab64890Smrg XFontSet font_set, 1261ab64890Smrg _Xconst wchar_t *text, 1271ab64890Smrg int text_len) 1281ab64890Smrg{ 1291ab64890Smrg return (*font_set->methods->wc_escapement) (font_set, text, text_len); 1301ab64890Smrg} 1311ab64890Smrg 1321ab64890Smrgint 1331ab64890SmrgXwcTextExtents( 1341ab64890Smrg XFontSet font_set, 1351ab64890Smrg _Xconst wchar_t *text, 1361ab64890Smrg int text_len, 1371ab64890Smrg XRectangle *overall_ink_extents, 1381ab64890Smrg XRectangle *overall_logical_extents) 1391ab64890Smrg{ 1401ab64890Smrg return (*font_set->methods->wc_extents) (font_set, text, text_len, 1411ab64890Smrg overall_ink_extents, 1421ab64890Smrg overall_logical_extents); 1431ab64890Smrg} 1441ab64890Smrg 1451ab64890SmrgStatus 1461ab64890SmrgXwcTextPerCharExtents( 1471ab64890Smrg XFontSet font_set, 1481ab64890Smrg _Xconst wchar_t *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{ 15761b2299dSmrg return (*font_set->methods->wc_extents_per_char) 15861b2299dSmrg (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