ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/text.c
(Generate patch)

Comparing ray/src/rt/text.c (file contents):
Revision 2.5 by greg, Fri Jun 19 14:20:22 1992 UTC vs.
Revision 2.10 by greg, Sun Nov 22 17:54:00 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 142 | Line 142 | char  *s;
142          if ((tl=(TLINE *)malloc(sizeof(TLINE)+siz)) == NULL ||
143                          (tl->spc=(short *)malloc(siz*sizeof(short))) == NULL)
144                  error(SYSTEM, "out of memory in tlalloc");
145        tl->spc = NULL;
145          tl->next = NULL;
146          strcpy(TLSTR(tl), s);
147          return(tl);
# Line 171 | Line 170 | register OBJREC  *tm;
170          if (tm->oargs.nsargs - tndx(tm) < 1 || tm->oargs.nfargs < sndx(tm))
171                  objerror(tm, USER, "bad # arguments");
172          if ((t = (TEXT *)malloc(sizeof(TEXT))) == NULL)
173 <                goto memerr;
173 >                error(SYSTEM, "out of memory in gettext");
174                                                  /* compute vectors */
175          fcross(DxR, D, R);
176          fcross(t->right, DxR, D);
# Line 221 | Line 220 | register OBJREC  *tm;
220          i = sndx(tm);
221          d = i < tm->oargs.nfargs ? tm->oargs.farg[i] : 0.0;
222          i = d * 256.0;
223 +        t->tl.width = 0;
224          for (tlp = t->tl.next; tlp != NULL; tlp = tlp->next) {
225                if ((tlp->spc = (short *)malloc(
226                                (strlen(TLSTR(tlp))+1)*sizeof(short))) == NULL)
227                        goto memerr;
225                  if (i < 0)
226                          tlp->width = squeeztext(tlp->spc, TLSTR(tlp), t->f, -i);
227                  else if (i > 0)
228                          tlp->width = proptext(tlp->spc, TLSTR(tlp), t->f, i, 3);
229                  else
230                          tlp->width = uniftext(tlp->spc, TLSTR(tlp), t->f);
231 +                if (tlp->width > t->tl.width)
232 +                        t->tl.width = tlp->width;
233          }
234                                                  /* we're done */
235          tm->os = (char *)t;
236          return(t);
238 memerr:
239        error(SYSTEM, "out of memory in gettext");
237   #undef  R
238   #undef  D
239   }
# Line 251 | Line 248 | OBJREC  *m;
248          tp = (TEXT *)m->os;
249          if (tp == NULL)
250                  return;
251 <        for (tlp = tp->tl.next; tlp != NULL; tlp = tlp->next) {
251 >        while ((tlp = tp->tl.next) != NULL) {
252 >                tp->tl.next = tlp->next;
253                  free((char *)tlp->spc);
254                  free((char *)tlp);
255          }
# Line 274 | Line 272 | OBJREC  *m;
272          v[0] = p[0] - m->oargs.farg[0];
273          v[1] = p[1] - m->oargs.farg[1];
274          v[2] = p[2] - m->oargs.farg[2];
275 <        h = x = DOT(v, tp->right)*256.;
275 >        x = DOT(v, tp->right);
276 >        i = sndx(m);
277 >        if (i < m->oargs.nfargs)
278 >                x *= tp->f->mwidth + 256.*fabs(m->oargs.farg[i]);
279 >        else
280 >                x *= 256.;
281 >        h = x;
282          i = y = DOT(v, tp->down);
283          if (x < 0.0 || y < 0.0)
284                  return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines