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 * Copyright 2000 by Bruno Haible 541ab64890Smrg * 551ab64890Smrg * Permission to use, copy, modify, distribute, and sell this software 561ab64890Smrg * and its documentation for any purpose is hereby granted without fee, 571ab64890Smrg * provided that the above copyright notice appear in all copies and 581ab64890Smrg * that both that copyright notice and this permission notice appear 591ab64890Smrg * in supporting documentation, and that the name of Bruno Haible not 601ab64890Smrg * be used in advertising or publicity pertaining to distribution of the 611ab64890Smrg * software without specific, written prior permission. Bruno Haible 621ab64890Smrg * makes no representations about the suitability of this software for 631ab64890Smrg * any purpose. It is provided "as is" without express or implied 641ab64890Smrg * warranty. 651ab64890Smrg * 661ab64890Smrg * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 671ab64890Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN 681ab64890Smrg * NO EVENT SHALL Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR 691ab64890Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 701ab64890Smrg * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 711ab64890Smrg * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 721ab64890Smrg * OR PERFORMANCE OF THIS SOFTWARE. 731ab64890Smrg */ 741ab64890Smrg 751ab64890Smrg#ifdef HAVE_CONFIG_H 761ab64890Smrg#include <config.h> 771ab64890Smrg#endif 781ab64890Smrg#include "Xlibint.h" 791ab64890Smrg#include "Xlcint.h" 801ab64890Smrg 811ab64890Smrgvoid 821ab64890SmrgXutf8DrawText( 831ab64890Smrg Display *dpy, 841ab64890Smrg Drawable d, 851ab64890Smrg GC gc, 861ab64890Smrg int x, 871ab64890Smrg int y, 881ab64890Smrg XmbTextItem *text_items, 891ab64890Smrg int nitems) 901ab64890Smrg{ 911ab64890Smrg register XFontSet fs = NULL; 921ab64890Smrg register XmbTextItem *p = text_items; 931ab64890Smrg register int i = nitems; 941ab64890Smrg register int esc; 951ab64890Smrg 961ab64890Smrg /* ignore leading items with no fontset */ 971ab64890Smrg while (i && !p->font_set) { 981ab64890Smrg i--; 991ab64890Smrg p++; 1001ab64890Smrg } 1011ab64890Smrg 1021ab64890Smrg for (; --i >= 0; p++) { 1031ab64890Smrg if (p->font_set) 1041ab64890Smrg fs = p->font_set; 1051ab64890Smrg x += p->delta; 1061ab64890Smrg esc = (*fs->methods->utf8_draw_string) (dpy, d, fs, gc, x, y, 1071ab64890Smrg p->chars, p->nchars); 1081ab64890Smrg if (!esc) 1091ab64890Smrg esc = fs->methods->utf8_escapement (fs, p->chars, p->nchars); 1101ab64890Smrg x += esc; 1111ab64890Smrg } 1121ab64890Smrg} 1131ab64890Smrg 1141ab64890Smrgvoid 1151ab64890SmrgXutf8DrawString( 1161ab64890Smrg Display *dpy, 1171ab64890Smrg Drawable d, 1181ab64890Smrg XFontSet font_set, 1191ab64890Smrg GC gc, 1201ab64890Smrg int x, 1211ab64890Smrg int y, 1221ab64890Smrg _Xconst char *text, 1231ab64890Smrg int text_len) 1241ab64890Smrg{ 1251ab64890Smrg (void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y, 126818534a1Smrg text, text_len); 1271ab64890Smrg} 1281ab64890Smrg 1291ab64890Smrg 1301ab64890Smrgvoid 1311ab64890SmrgXutf8DrawImageString( 1321ab64890Smrg Display *dpy, 1331ab64890Smrg Drawable d, 1341ab64890Smrg XFontSet font_set, 1351ab64890Smrg GC gc, 1361ab64890Smrg int x, 1371ab64890Smrg int y, 1381ab64890Smrg _Xconst char *text, 1391ab64890Smrg int text_len) 1401ab64890Smrg{ 1411ab64890Smrg (*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y, 142818534a1Smrg text, text_len); 1431ab64890Smrg} 1441ab64890Smrg 14561b2299dSmrgint 1461ab64890SmrgXutf8TextEscapement( 1471ab64890Smrg XFontSet font_set, 1481ab64890Smrg _Xconst char *text, 1491ab64890Smrg int text_len) 1501ab64890Smrg{ 151818534a1Smrg return (*font_set->methods->utf8_escapement) (font_set, text, text_len); 1521ab64890Smrg} 1531ab64890Smrg 1541ab64890Smrgint 1551ab64890SmrgXutf8TextExtents( 1561ab64890Smrg XFontSet font_set, 1571ab64890Smrg _Xconst char *text, 1581ab64890Smrg int text_len, 1591ab64890Smrg XRectangle *overall_ink_extents, 1601ab64890Smrg XRectangle *overall_logical_extents) 1611ab64890Smrg{ 162818534a1Smrg return (*font_set->methods->utf8_extents) (font_set, text, text_len, 1631ab64890Smrg overall_ink_extents, 1641ab64890Smrg overall_logical_extents); 1651ab64890Smrg} 1661ab64890Smrg 1671ab64890SmrgStatus 1681ab64890SmrgXutf8TextPerCharExtents( 1691ab64890Smrg XFontSet font_set, 1701ab64890Smrg _Xconst char *text, 1711ab64890Smrg int text_len, 1721ab64890Smrg XRectangle *ink_extents_buffer, 1731ab64890Smrg XRectangle *logical_extents_buffer, 1741ab64890Smrg int buffer_size, 1751ab64890Smrg int *num_chars, 1761ab64890Smrg XRectangle *max_ink_extents, 1771ab64890Smrg XRectangle *max_logical_extents) 1781ab64890Smrg{ 1791ab64890Smrg return (*font_set->methods->utf8_extents_per_char) 180818534a1Smrg (font_set, text, text_len, 1811ab64890Smrg ink_extents_buffer, logical_extents_buffer, 1821ab64890Smrg buffer_size, num_chars, max_ink_extents, max_logical_extents); 1831ab64890Smrg} 184