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

  1.  
  2. #include "Xlib_private.h"
  3.  
  4. int Xlib_SetFont(Pixmap pixmap, Font font)
  5. {
  6.     DBUG_ENTER("Xlib_SetFont")
  7.     LONG atom = LCID_DEFAULT;
  8.     if (!pixmap) DBUG_RETURN(0);
  9.     if (font) {
  10.         atom = Xlib_AllocFontAtom((Xlib_Pixmap *)pixmap, (Xlib_Font *)font);
  11.         if (!atom) {
  12.             x11_console_notice("Out of free GPI atoms!\n");
  13.             /* Perhaps need some LRU disposal schema */
  14.             DBUG_RETURN(0);
  15.         }
  16.     }
  17.     GpiSetCharSet(((Xlib_Pixmap *)pixmap)->hps, atom);
  18.     if (font && ((Xlib_Font *)font)->psmode)
  19.     GpiSetCharBox(((Xlib_Pixmap *)pixmap)->hps, &((Xlib_Font *)font)->sizef);
  20.     DBUG_RETURN(1);
  21. }
  22.  
  23. int XSetFont(Display* dpy, GC gc, Font font)
  24. {
  25.     DBUG_ENTER("XSetFont")
  26.     Xlib_GC *xgc = (Xlib_GC *)gc;
  27.     HPS hps = NULLHANDLE;
  28.     int result = 0;
  29.     if (!xgc) DBUG_RETURN(0);
  30.     if ((xgc->values.font = font))
  31.         Xlib_MonitorResource((XID *)&xgc->values.font);
  32.     if (GetDrawableHeight(0, gc, &hps, GC_NOPATH)) {
  33.         if (xgc->pixmap)
  34.             result = Xlib_SetFont((Pixmap)xgc->pixmap, font);
  35.         else
  36.         if (xgc->winattrib)
  37.             result = Xlib_SetFont((Pixmap)xgc->winattrib, font);
  38.     }
  39.     SyncHandle();
  40.     DBUG_RETURN(result);
  41. }
  42.