home *** CD-ROM | disk | FTP | other *** search
- /*
- * lemtext.c - text primitives
- *
- * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
- */
-
- #include "lem.h"
- #include "lemfont.h"
-
- textadd(x0, y0, s)
- char *s;
- {
- int i;
- if ((!s) || (strlen(s) == 0)) return;
- i = objalloc(TEXT);
- Otext = salloc(s);
- Oxs = x0;
- Oys = y0;
- textresize(i);
- objnew(i);
- }
-
- textresize(i)
- {
- Oxe = fontmeasure(bfont[Osizer], Otext, Oemph);
- Oye = lemfont[Osizer].psize;
- }
-
- textnearpt(i, x, y)
- {
- return(ptinrect(x, y, Oxlt, Oylt, Oxht, Oyht, TEXTTOL)); /* must be ON the text */
- }
-
- textinrect(i, xl, yl, xh, yh)
- {
- return(ptinrect(Oxlt, Oylt, xl, yl, xh, yh, TEXTTOL) &&
- ptinrect(Oxht, Oyht, xl, yl, xh, yh, TEXTTOL) );
- }
-
- textcantug(i, x, y)
- {
- return(textnearpt(i, x, y));
- }
-
- texttug(i, xs, ys, xe, ye)
- {
- Oxs += xe-xs;
- Oys += ye-ys;
- }
-
- textalign(i, x, y)
- int *x, *y;
- {
- *x = Oxs;
- *y = Oys;
- }
-
- textmove(i, x, y)
- {
- Oxs += x;
- Oys += y;
- }
-
- textaffine(i, m11, m12, m21, m22)
- float m11, m12, m21, m22;
- {
- objsupaffine(i, m11, m12, m21, m22, 0);
- }
-
- textdraw(i, col)
- {
- fontwrite(Osizer, Oxlt, Oys, Otext, Oemph, col);
- }
-