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.25 by schorsch, Tue Mar 30 16:13:01 2004 UTC vs.
Revision 2.28 by greg, Fri Nov 19 22:51:31 2021 UTC

# Line 82 | Line 82 | static int intext(FVECT p, OBJREC *m);
82   static int inglyph(double x, double y, GLYPH *gl);
83  
84  
85 < extern int
85 > int
86   do_text(
87 <        register OBJREC  *m,
87 >        OBJREC  *m,
88          RAY  *r
89   )
90   {
# Line 138 | Line 138 | tlalloc(                       /* allocate and assign text line */
138          char  *s
139   )
140   {
141 <        register int  siz;
142 <        register TLINE  *tl;
141 >        int  siz;
142 >        TLINE  *tl;
143  
144          siz = strlen(s) + 1;
145          if ((tl=(TLINE *)malloc(sizeof(TLINE)+siz)) == NULL ||
# Line 153 | Line 153 | tlalloc(                       /* allocate and assign text line */
153  
154   static TEXT *
155   gettext(                        /* get text structure for material */
156 <        register OBJREC  *tm
156 >        OBJREC  *tm
157   )
158   {
159   #define  R      (tm->oargs.farg+3)
# Line 163 | Line 163 | gettext(                       /* get text structure for material */
163          FILE  *fp;
164          char  linbuf[512];
165          TEXT  *t;
166 <        register int  i;
167 <        register TLINE  *tlp;
168 <        register char  *s;
166 >        int  i;
167 >        TLINE  *tlp;
168 >        char  *s;
169  
170          if ((t = (TEXT *)tm->os) != NULL)
171                  return(t);
# Line 204 | Line 204 | gettext(                       /* get text structure for material */
204                                  getrlibpath(), R_OK)) == NULL) {
205                          sprintf(errmsg, "cannot find text file \"%s\"",
206                                          tm->oargs.sarg[tndx(tm)]);
207 <                        error(USER, errmsg);
207 >                        error(SYSTEM, errmsg);
208                  }
209                  if ((fp = fopen(s, "r")) == NULL) {
210                          sprintf(errmsg, "cannot open text file \"%s\"", s);
# Line 222 | Line 222 | gettext(                       /* get text structure for material */
222          tlp->next = NULL;
223                                                  /* get the font */
224          t->f = getfont(tm->oargs.sarg[fndx(tm)]);
225 +        if (!t->f)
226 +                objerror(tm, USER, "font load error");
227                                                  /* compute character spacing */
228          i = sndx(tm);
229          d = i < tm->oargs.nfargs ? tm->oargs.farg[i] : 0.0;
# Line 245 | Line 247 | gettext(                       /* get text structure for material */
247   }
248  
249  
250 < extern void
250 > void
251   freetext(                       /* free text structures associated with m */
252          OBJREC  *m
253   )
254   {
255 <        register TEXT  *tp;
256 <        register TLINE  *tlp;
255 >        TEXT  *tp;
256 >        TLINE  *tlp;
257  
258          tp = (TEXT *)m->os;
259          if (tp == NULL)
# Line 273 | Line 275 | intext(                        /* check to see if p is in text glyph */
275          OBJREC  *m
276   )
277   {
278 <        register TEXT  *tp;
279 <        register TLINE  *tlp;
278 >        TEXT  *tp;
279 >        TLINE  *tlp;
280          FVECT  v;
281          double  y, x;
282 <        register int  i, h;
282 >        int  i, h;
283                                  /* first, compute position in text */
284          tp = gettext(m);
285          v[0] = p[0] - m->oargs.farg[0];
# Line 313 | Line 315 | static int
315   inglyph(                /* (x,y) within font glyph gl? */
316          double  x,              /* real coordinates in range [0,255) */
317          double  y,
318 <        register GLYPH  *gl
318 >        GLYPH  *gl
319   )
320   {
321          int  n, ncross;
322          int  xlb, ylb;
323          int  tv;
324 <        register GORD  *p0, *p1;
324 >        GORD  *p0, *p1;
325  
326          if (gl == NULL)
327                  return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines