8 int i, sub, nstr, at, with, hset;
9 double xwith, ywith, h, w, x0, y0, x1, y1;
11 static double prevh = 0;
12 static double prevw = 0;
15 at = with = nstr = hset = 0;
16 h = getfval("textht");
17 w = getfval("textwid");
18 for (i = 0; i < nattr; i++) {
39 if (ap->a_val.p == NULL) /* an isolated modifier */
40 text[ntext-1].t_type = sub;
42 savetext(sub, ap->a_val.p);
48 if (hset == 0) /* no explicit ht cmd */
53 case NORTH: ywith = -h / 2; break;
54 case SOUTH: ywith = h / 2; break;
55 case EAST: xwith = -w / 2; break;
56 case WEST: xwith = w / 2; break;
57 case NE: xwith = -w / 2; ywith = -h / 2; break;
58 case SE: xwith = -w / 2; ywith = h / 2; break;
59 case NW: xwith = w / 2; ywith = -h / 2; break;
60 case SW: xwith = w / 2; ywith = h / 2; break;
68 else if (isleft(hvmode))
70 else if (isup(hvmode))
81 dprintf("Text h %g w %g at %g,%g\n", h, w, curx, cury);
82 p = makenode(TEXT, 2);
87 else if (isleft(hvmode))
89 else if (isup(hvmode))
99 troffgen(char *s) /* save away a string of troff commands */
101 savetext(CENTER, s); /* use the existing text mechanism */
102 return makenode(TROFF, 0);
106 savetext(int t, char *s) /* record text elements for current object */
108 if (ntext >= ntextlist)
109 text = (Text *) grow((char *) text, "text", ntextlist += 200, sizeof(Text));
110 text[ntext].t_type = t;
111 text[ntext].t_val = s;
112 dprintf("saving %d text %s at %d\n", t, s, ntext);