home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / textutil / tex / p_drivers / !TeX / TeXSource / beebe / h / setchar < prev   
Encoding:
Text File  |  1992-01-13  |  1.4 KB  |  56 lines

  1. /* -*-C-*- setchar.h */
  2. /*-->setchar*/
  3. /**********************************************************************/
  4. /****************************** setchar *******************************/
  5. /**********************************************************************/
  6.  
  7. #ifdef __STDC__
  8. void
  9. setchar(register BYTE c, register BOOLEAN update_h)
  10. #else
  11. void
  12. setchar(c, update_h)
  13. register BYTE c;
  14. register BOOLEAN update_h;
  15. #endif
  16. {
  17.     register struct char_entry *tcharptr;  /* temporary char_entry pointer */
  18.  
  19.     if (DBGOPT(DBG_SET_TEXT))
  20.     {
  21.     (void)fprintf(stderr,"setchar('");
  22.     if (isprint(c))
  23.         (void)putc(c,stderr);
  24.     else
  25.         (void)fprintf(stderr,"\\%03o",(int)c);
  26.     (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
  27.         (int)c, (long)hh, (long)vv, fontptr->n);
  28.     NEWLINE(stderr);
  29.     }
  30.  
  31.     tcharptr = &(fontptr->ch[c]);
  32.     if (((hh - tcharptr->xoffp + tcharptr->pxlw) <= XSIZE)
  33.     && (hh >= 0)
  34.     && (vv <= YSIZE)
  35.     && (vv >= 0))
  36.     {                /* character fits entirely on page */
  37.     moveto( hh, (COORDINATE)(YSIZE-vv));
  38.     dispchar(c);
  39.     }
  40.     else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
  41.     {                /* character is off page -- discard it */
  42.     (void)fprintf(stderr,
  43.         "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
  44.         isprint(c) ? c : '?',c,c,c);
  45.     NEWLINE(stderr);
  46.     }
  47.  
  48.     if (update_h)
  49.     {
  50.     h += (INT32)tcharptr->tfmw;
  51.     hh += (COORDINATE)tcharptr->pxlw;
  52.     hh = (COORDINATE)(fixpos(hh-lmargin,h,conv) + lmargin);
  53.     }
  54. }
  55.  
  56.