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

Comparing ray/src/px/psign.c (file contents):
Revision 2.13 by greg, Mon Sep 21 12:14:30 1992 UTC vs.
Revision 2.20 by schorsch, Sun Jun 8 12:03:10 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  psign.c - produce picture from text.
6   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   */
9  
10   #include  "standard.h"
11 <
11 > #include  "platform.h"
12   #include  "color.h"
16
13   #include  "font.h"
14  
19 #include  "paths.h"
20
15   #ifndef  SSS
16   #define  SSS                    3       /* super-sample size */
17   #endif
# Line 48 | Line 42 | int  xdim;                             /* size of horizontal scan (bytes) */
42  
43   FONT  *ourfont;                         /* our font */
44  
51 char  *libpath;                         /* library search path */
52
45   typedef struct line {
46          char  *s;               /* line w/o LF */
47          short  *sp;             /* character spacing */
# Line 66 | Line 58 | int  argc;
58   char  *argv[];
59   {
60          int  an;
61 < #ifdef MSDOS
70 <        setmode(fileno(stdout), O_BINARY);
71 < #endif
61 >        SET_FILE_BINARY(stdout);
62          for (an = 1; an < argc && argv[an][0] == '-'; an++)
63                  switch (argv[an][1]) {
64                  case 'c':                       /* color */
# Line 126 | Line 116 | unkopt:
116                          exit(1);
117                  }
118                                          /* load font file */
129        if ((libpath = getenv(ULIBVAR)) == NULL)
130                libpath = DEFPATH;
119          ourfont = getfont(fontfile);
120                                          /* get text */
121          if (an == argc)
# Line 140 | Line 128 | unkopt:
128                                          /* convert text to bitmap */
129          maptext();
130                                          /* print header */
131 +        newheader("RADIANCE", stdout);
132          printargs(argc, argv, stdout);
133          fputformat(COLRFMT, stdout);
134          putchar('\n');
# Line 168 | Line 157 | makemap()                      /* create the bit map */
157                          else
158                                  xsiz = ysiz/pictaspect + 0.5;
159                          cheight = ysiz/nlines;
160 <                        cwidth = cheight/aspect + 0.5;
160 >                        cwidth = cheight/aspect;
161                  } else {
162                          if (ysiz <= 0)
163                                  ysiz = cheight*nlines;
164                          pictaspect = (double)ysiz/xsiz;
165                          aspect = pictaspect*maxwidth/(256*nlines);
166                          cheight = ysiz/nlines;
167 <                        cwidth = cheight/aspect + 0.5;
167 >                        cwidth = cheight/aspect;
168                  }
169          } else {                        /* reverse orientation */
170                  if (ysiz <= 0) {
# Line 191 | Line 180 | makemap()                      /* create the bit map */
180                          else
181                                  xsiz = ysiz/pictaspect + 0.5;
182                          cheight = xsiz/nlines;
183 <                        cwidth = cheight/aspect + 0.5;
183 >                        cwidth = cheight/aspect;
184                  } else {
185                          if (xsiz <= 0)
186                                  xsiz = cheight*nlines;
187                          pictaspect = (double)ysiz/xsiz;
188                          aspect = maxwidth/(256*nlines*pictaspect);
189                          cheight = xsiz/nlines;
190 <                        cwidth = cheight/aspect + 0.5;
190 >                        cwidth = cheight/aspect;
191                  }
192          }
193          if (xsiz % SSS)
# Line 216 | Line 205 | makemap()                      /* create the bit map */
205   gettext(fp)                     /* get text from a file */
206   FILE  *fp;
207   {
219        char  *fgets();
208          char  buf[MAXLINE];
209          register LINE  *curl;
210          int  len;
# Line 229 | Line 217 | FILE  *fp;
217                  if (curl == NULL)
218                          goto memerr;
219                  len = strlen(buf);
220 <                curl->s = malloc(len);
220 >                curl->s = (char *)malloc(len);
221                  curl->sp = (short *)malloc(sizeof(short)*len--);
222                  if (curl->s == NULL | curl->sp == NULL)
223                          goto memerr;
# Line 239 | Line 227 | FILE  *fp;
227                  curl->s[len] = '\0';
228                  if (spacing < -1./256.)
229                          len = squeeztext(curl->sp, curl->s, ourfont,
230 <                                        (int)(spacing*-256.0));
230 >                                        (int)(spacing*-256.));
231                  else if (spacing > 1./256.)
232                          len = proptext(curl->sp, curl->s, ourfont,
233 <                                        (int)(spacing*256.0), 3);
233 >                                        (int)(spacing*256.), 3);
234                  else
235                          len = uniftext(curl->sp, curl->s, ourfont);
236                  if (len > maxwidth)
# Line 266 | Line 254 | char  *av[];
254          ourtext = (LINE *)malloc(sizeof(LINE));
255          if (ourtext == NULL)
256                  goto memerr;
257 <        ourtext->s = malloc(MAXLINE);
257 >        ourtext->s = (char *)malloc(MAXLINE);
258          if (ourtext->s == NULL)
259                  goto memerr;
260          for (cp = ourtext->s; ac-- > 0; av++) {
# Line 280 | Line 268 | char  *av[];
268          ourtext->sp = (short *)malloc(sizeof(short)*(maxline+1));
269          if (ourtext->sp == NULL)
270                  goto memerr;
271 <        if (spacing < 0.0)
271 >        if (spacing < -1./256.)
272                  maxwidth = squeeztext(ourtext->sp, ourtext->s, ourfont,
273 <                                (int)(spacing*-256.0));
274 <        else if (spacing > 0.0)
273 >                                (int)(spacing*-256.));
274 >        else if (spacing > 1./256.)
275                  maxwidth = proptext(ourtext->sp, ourtext->s, ourfont,
276 <                                (int)(spacing*256.0), 3);
276 >                                (int)(spacing*256.), 3);
277          else
278                  maxwidth = uniftext(ourtext->sp, ourtext->s, ourfont);
279          nlines = 1;
# Line 444 | Line 432 | FILE  *fp;
432                          exit(1);
433                  }
434          }
435 <        free((char *)scanout);
435 >        free((void *)scanout);
436   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines