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.29 by greg, Wed Nov 15 18:02:53 2023 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 113 | Line 113 | do_text(
113                          return(1);
114                  }
115          } else if (m->otype == PAT_BTEXT) {
116 <                if (foreground)
117 <                        scalecolor(r->pcol, m->oargs.farg[9]);
118 <                else
119 <                        scalecolor(r->pcol, m->oargs.farg[10]);
116 >                if (foreground) {
117 >                        scalescolor(r->pcol, m->oargs.farg[9]);
118 >                } else {
119 >                        scalescolor(r->pcol, m->oargs.farg[10]);
120 >                }
121          } else { /* PAT_CTEXT */
122 <                COLOR  cval;
122 >                SCOLOR  scval;
123                  if (foreground)
124 <                        setcolor(cval, m->oargs.farg[9],
124 >                        setscolor(scval, m->oargs.farg[9],
125                                          m->oargs.farg[10],
126                                          m->oargs.farg[11]);
127                  else
128 <                        setcolor(cval, m->oargs.farg[12],
128 >                        setscolor(scval, m->oargs.farg[12],
129                                          m->oargs.farg[13],
130                                          m->oargs.farg[14]);
131 <                multcolor(r->pcol, cval);
131 >                smultscolor(r->pcol, scval);
132          }
133          return(0);
134   }
# Line 138 | Line 139 | tlalloc(                       /* allocate and assign text line */
139          char  *s
140   )
141   {
142 <        register int  siz;
143 <        register TLINE  *tl;
142 >        int  siz;
143 >        TLINE  *tl;
144  
145          siz = strlen(s) + 1;
146          if ((tl=(TLINE *)malloc(sizeof(TLINE)+siz)) == NULL ||
# Line 153 | Line 154 | tlalloc(                       /* allocate and assign text line */
154  
155   static TEXT *
156   gettext(                        /* get text structure for material */
157 <        register OBJREC  *tm
157 >        OBJREC  *tm
158   )
159   {
160   #define  R      (tm->oargs.farg+3)
# Line 163 | Line 164 | gettext(                       /* get text structure for material */
164          FILE  *fp;
165          char  linbuf[512];
166          TEXT  *t;
167 <        register int  i;
168 <        register TLINE  *tlp;
169 <        register char  *s;
167 >        int  i;
168 >        TLINE  *tlp;
169 >        char  *s;
170  
171          if ((t = (TEXT *)tm->os) != NULL)
172                  return(t);
# Line 204 | Line 205 | gettext(                       /* get text structure for material */
205                                  getrlibpath(), R_OK)) == NULL) {
206                          sprintf(errmsg, "cannot find text file \"%s\"",
207                                          tm->oargs.sarg[tndx(tm)]);
208 <                        error(USER, errmsg);
208 >                        error(SYSTEM, errmsg);
209                  }
210                  if ((fp = fopen(s, "r")) == NULL) {
211                          sprintf(errmsg, "cannot open text file \"%s\"", s);
# Line 222 | Line 223 | gettext(                       /* get text structure for material */
223          tlp->next = NULL;
224                                                  /* get the font */
225          t->f = getfont(tm->oargs.sarg[fndx(tm)]);
226 +        if (!t->f)
227 +                objerror(tm, USER, "font load error");
228                                                  /* compute character spacing */
229          i = sndx(tm);
230          d = i < tm->oargs.nfargs ? tm->oargs.farg[i] : 0.0;
# Line 245 | Line 248 | gettext(                       /* get text structure for material */
248   }
249  
250  
251 < extern void
251 > void
252   freetext(                       /* free text structures associated with m */
253          OBJREC  *m
254   )
255   {
256 <        register TEXT  *tp;
257 <        register TLINE  *tlp;
256 >        TEXT  *tp;
257 >        TLINE  *tlp;
258  
259          tp = (TEXT *)m->os;
260          if (tp == NULL)
# Line 273 | Line 276 | intext(                        /* check to see if p is in text glyph */
276          OBJREC  *m
277   )
278   {
279 <        register TEXT  *tp;
280 <        register TLINE  *tlp;
279 >        TEXT  *tp;
280 >        TLINE  *tlp;
281          FVECT  v;
282          double  y, x;
283 <        register int  i, h;
283 >        int  i, h;
284                                  /* first, compute position in text */
285          tp = gettext(m);
286          v[0] = p[0] - m->oargs.farg[0];
# Line 313 | Line 316 | static int
316   inglyph(                /* (x,y) within font glyph gl? */
317          double  x,              /* real coordinates in range [0,255) */
318          double  y,
319 <        register GLYPH  *gl
319 >        GLYPH  *gl
320   )
321   {
322          int  n, ncross;
323          int  xlb, ylb;
324          int  tv;
325 <        register GORD  *p0, *p1;
325 >        GORD  *p0, *p1;
326  
327          if (gl == NULL)
328                  return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines