home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / lemming / part02 / lemtext.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-08-05  |  1.2 KB  |  74 lines

  1. /*
  2.  * lemtext.c - text primitives
  3.  *
  4.  * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
  5.  */
  6.  
  7. #include "lem.h"
  8. #include "lemfont.h"
  9.  
  10. textadd(x0, y0, s)
  11.     char *s;
  12.     {
  13.     int i;
  14.     if ((!s) || (strlen(s) == 0)) return;
  15.     i = objalloc(TEXT);
  16.     Otext = salloc(s);
  17.     Oxs = x0;
  18.     Oys = y0;
  19.     textresize(i);
  20.     objnew(i);
  21.     }
  22.  
  23. textresize(i)
  24.     {
  25.     Oxe = fontmeasure(bfont[Osizer], Otext, Oemph);
  26.     Oye = lemfont[Osizer].psize;
  27.     }
  28.  
  29. textnearpt(i, x, y)
  30.     {
  31.     return(ptinrect(x, y, Oxlt, Oylt, Oxht, Oyht, TEXTTOL));    /* must be ON the text */
  32.     }
  33.  
  34. textinrect(i, xl, yl, xh, yh)
  35.     {
  36.     return(ptinrect(Oxlt, Oylt, xl, yl, xh, yh, TEXTTOL) &&
  37.     ptinrect(Oxht, Oyht, xl, yl, xh, yh, TEXTTOL) );
  38.     }
  39.  
  40. textcantug(i, x, y)
  41.     {
  42.     return(textnearpt(i, x, y));
  43.     }
  44.  
  45. texttug(i, xs, ys, xe, ye)
  46.     {
  47.     Oxs += xe-xs;
  48.     Oys += ye-ys;
  49.     }
  50.  
  51. textalign(i, x, y)
  52.     int *x, *y;
  53.     {
  54.     *x = Oxs;
  55.     *y = Oys;
  56.     }
  57.  
  58. textmove(i, x, y)
  59.     {
  60.     Oxs += x;
  61.     Oys += y;
  62.     }
  63.  
  64. textaffine(i, m11, m12, m21, m22)
  65.     float m11, m12, m21, m22;
  66.     {
  67.     objsupaffine(i, m11, m12, m21, m22, 0);
  68.     }
  69.  
  70. textdraw(i, col)
  71.     {
  72.     fontwrite(Osizer, Oxlt, Oys, Otext, Oemph, col);
  73.     }
  74.