7 int i
, sub
, nstr
, at
, with
, hset
, invis
;
8 double xwith
, ywith
, h
, w
, x0
, y0
, x1
, y1
;
10 static double prevh
= 0;
11 static double prevw
= 0;
14 at
= with
= nstr
= hset
= invis
= 0;
15 h
= getfval("textht");
16 w
= getfval("textwid");
17 for (i
= 0; i
< nattr
; i
++) {
41 if (ap
->a_val
.p
== NULL
) /* an isolated modifier */
42 text
[ntext
-1].t_type
= sub
;
44 savetext(sub
, ap
->a_val
.p
);
50 if (hset
== 0) /* no explicit ht cmd */
55 case NORTH
: ywith
= -h
/ 2; break;
56 case SOUTH
: ywith
= h
/ 2; break;
57 case EAST
: xwith
= -w
/ 2; break;
58 case WEST
: xwith
= w
/ 2; break;
59 case NE
: xwith
= -w
/ 2; ywith
= -h
/ 2; break;
60 case SE
: xwith
= -w
/ 2; ywith
= h
/ 2; break;
61 case NW
: xwith
= w
/ 2; ywith
= -h
/ 2; break;
62 case SW
: xwith
= w
/ 2; ywith
= h
/ 2; break;
70 else if (isleft(hvmode
))
72 else if (isup(hvmode
))
83 dprintf("Text h %g w %g at %g,%g\n", h
, w
, curx
, cury
);
84 p
= makenode(TEXT
, 2);
90 else if (isleft(hvmode
))
92 else if (isup(hvmode
))
101 obj
*troffgen(char *s
) /* save away a string of troff commands */
103 savetext(CENTER
, s
); /* use the existing text mechanism */
104 return makenode(TROFF
, 0);
107 void savetext(int t
, char *s
) /* record text elements for current object */
109 if (ntext
>= ntextlist
)
110 text
= (Text
*) grow((char *) text
, "text", ntextlist
+= 200, sizeof(Text
));
111 text
[ntext
].t_type
= t
;
112 text
[ntext
].t_val
= s
;
113 dprintf("saving %d text %s at %d\n", t
, s
, ntext
);