home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xmb_Wrap.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  8KB  |  235 lines

  1. /* $XConsortium: mbWrap.c,v 11.6 94/04/17 20:22:15 rws Exp $ */
  2. /*
  3.  
  4. Copyright (c) 1991  X Consortium
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining
  7. a copy of this software and associated documentation files (the
  8. "Software"), to deal in the Software without restriction, including
  9. without limitation the rights to use, copy, modify, merge, publish,
  10. distribute, sublicense, and/or sell copies of the Software, and to
  11. permit persons to whom the Software is furnished to do so, subject to
  12. the following conditions:
  13.  
  14. The above copyright notice and this permission notice shall be included
  15. in all copies or substantial portions of the Software.
  16.  
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  18. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21. OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. OTHER DEALINGS IN THE SOFTWARE.
  24.  
  25. Except as contained in this notice, the name of the X Consortium shall
  26. not be used in advertising or otherwise to promote the sale, use or
  27. other dealings in this Software without prior written authorization
  28. from the X Consortium.
  29.  
  30. */
  31. /*
  32.  * Copyright 1991 by the Open Software Foundation
  33.  *
  34.  * Permission to use, copy, modify, distribute, and sell this software and its
  35.  * documentation for any purpose is hereby granted without fee, provided that
  36.  * the above copyright notice appear in all copies and that both that
  37.  * copyright notice and this permission notice appear in supporting
  38.  * documentation, and that the name of Open Software Foundation 
  39.  * not be used in advertising or publicity pertaining to distribution of the
  40.  * software without specific, written prior permission.  Open Software
  41.  * Foundation makes no representations about the suitability of this
  42.  * software for any purpose.  It is provided "as is" without express or
  43.  * implied warranty.
  44.  *
  45.  * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO
  46.  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  47.  * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE
  48.  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
  49.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  50.  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  51.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  52.  * 
  53.  *         M. Collins        OSF  
  54.  */                
  55.  
  56. #include "Xlib_private.h"
  57. #include "Xlcint.h"
  58.  
  59. void
  60. XmbDrawText(dpy, d, gc, x, y, text_items, nitems)
  61.     Display            *dpy;
  62.     Drawable            d;
  63.     GC                  gc;
  64.     int                 x, y;
  65.     XmbTextItem        *text_items;
  66.     int                 nitems;
  67. {
  68.     DBUG_ENTER("XmbDrawText")
  69.     register XFontSet fs;
  70.     register XmbTextItem *p = text_items;
  71.     register int i = nitems;
  72.     register int esc;
  73.  
  74.     /* ignore leading items with no fontset */
  75.     while (i && !p->font_set) {
  76.     i--;
  77.     p++;
  78.     }
  79.  
  80.     for (; --i >= 0; p++) {
  81.     if (p->font_set)
  82.         fs = p->font_set;
  83.     x += p->delta;
  84.     esc = (*fs->methods->mb_draw_string) (dpy, d, fs, gc, x, y,
  85.                           p->chars, p->nchars);
  86.     if (!esc)
  87.         esc = fs->methods->mb_escapement (fs, p->chars, p->nchars);
  88.     x += esc;
  89.     }
  90.     DBUG_VOID_RETURN;
  91. }
  92.  
  93. #if NeedFunctionPrototypes
  94. void
  95. XmbDrawString(
  96.     Display            *dpy,
  97.     Drawable            d,
  98.     XFontSet            font_set,
  99.     GC                  gc,
  100.     int                 x,
  101.     int                 y,
  102.     _Xconst char       *text,
  103.     int                 text_len)
  104. #else
  105. void
  106. XmbDrawString(dpy, d, font_set, gc, x, y, text, text_len)
  107.     Display            *dpy;
  108.     Drawable            d;
  109.     XFontSet            font_set;
  110.     GC                  gc;
  111.     int                 x, y;
  112.     char               *text;
  113.     int                 text_len;
  114. #endif
  115. {
  116.     DBUG_ENTER("XmbDrawString")
  117.     (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y,
  118.                         (char *)text, text_len);
  119.     DBUG_VOID_RETURN;
  120. }
  121.  
  122.  
  123. #if NeedFunctionPrototypes
  124. void
  125. XmbDrawImageString(
  126.     Display            *dpy,
  127.     Drawable            d,
  128.     XFontSet            font_set,
  129.     GC                  gc,
  130.     int                 x,
  131.     int                 y,
  132.     _Xconst char       *text,
  133.     int                 text_len)
  134. #else
  135. void
  136. XmbDrawImageString(dpy, d, font_set, gc, x, y, text, text_len)
  137.     Display            *dpy;
  138.     Drawable            d;
  139.     XFontSet            font_set;
  140.     GC                  gc;
  141.     int                 x, y;
  142.     char               *text;
  143.     int                 text_len;
  144. #endif
  145. {
  146.     DBUG_ENTER("XmbDrawImageString")
  147.     (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y,
  148.                         (char *)text, text_len);
  149.     DBUG_VOID_RETURN;
  150. }
  151.  
  152. #if NeedFunctionPrototypes
  153. int 
  154. XmbTextEscapement(
  155.     XFontSet        font_set,
  156.     _Xconst char   *text,
  157.     int             text_len)
  158. #else
  159. int 
  160. XmbTextEscapement(font_set, text, text_len)
  161.     XFontSet        font_set;
  162.     char           *text;
  163.     int             text_len;
  164. #endif
  165. {
  166.     DBUG_ENTER("XmbTextEscapement")
  167.     int result = (*font_set->methods->mb_escapement) (font_set,
  168.                         (char *)text, text_len);
  169.     DBUG_RETURN(result);
  170. }
  171.  
  172. #if NeedFunctionPrototypes
  173. int
  174. XmbTextExtents(
  175.     XFontSet        font_set,
  176.     _Xconst char   *text,
  177.     int             text_len,
  178.     XRectangle     *overall_ink_extents,
  179.     XRectangle     *overall_logical_extents)
  180. #else
  181. int
  182. XmbTextExtents(font_set, text, text_len,
  183.            overall_ink_extents, overall_logical_extents)
  184.     XFontSet        font_set;
  185.     char           *text;
  186.     int             text_len;
  187.     XRectangle     *overall_ink_extents;
  188.     XRectangle     *overall_logical_extents;
  189. #endif
  190. {
  191.     DBUG_ENTER("XmbTextExtents")
  192.     int result = (*font_set->methods->mb_extents) (font_set,
  193.                          (char *)text, text_len,
  194.                          overall_ink_extents,
  195.                          overall_logical_extents);
  196.     DBUG_RETURN(result);
  197. }
  198.  
  199. #if NeedFunctionPrototypes
  200. Status
  201. XmbTextPerCharExtents(
  202.     XFontSet        font_set,
  203.     _Xconst char   *text,
  204.     int             text_len,
  205.     XRectangle     *ink_extents_buffer,
  206.     XRectangle     *logical_extents_buffer,
  207.     int             buffer_size,
  208.     int            *num_chars,
  209.     XRectangle     *max_ink_extents,
  210.     XRectangle     *max_logical_extents)
  211. #else
  212. Status
  213. XmbTextPerCharExtents(font_set, text, text_len,
  214.               ink_extents_buffer, logical_extents_buffer,
  215.               buffer_size, num_chars,
  216.               max_ink_extents, max_logical_extents)
  217.     XFontSet        font_set;
  218.     char           *text;
  219.     int             text_len;
  220.     XRectangle     *ink_extents_buffer;
  221.     XRectangle     *logical_extents_buffer;
  222.     int             buffer_size;
  223.     int            *num_chars;
  224.     XRectangle     *max_ink_extents;
  225.     XRectangle     *max_logical_extents;
  226. #endif
  227. {
  228.     DBUG_ENTER("XmbTextPerCharExtents")
  229.     Status result = (*font_set->methods->mb_extents_per_char)
  230.          (font_set, (char *)text, text_len, 
  231.           ink_extents_buffer, logical_extents_buffer,
  232.           buffer_size, num_chars, max_ink_extents, max_logical_extents);
  233.     DBUG_RETURN(result);
  234. }
  235.