| 16 |
|
|
| 17 |
|
#include "font.h" |
| 18 |
|
|
| 19 |
– |
#include "paths.h" |
| 20 |
– |
|
| 19 |
|
#ifndef SSS |
| 20 |
|
#define SSS 3 /* super-sample size */ |
| 21 |
|
#endif |
| 46 |
|
|
| 47 |
|
FONT *ourfont; /* our font */ |
| 48 |
|
|
| 51 |
– |
char *libpath; /* library search path */ |
| 52 |
– |
|
| 49 |
|
typedef struct line { |
| 50 |
|
char *s; /* line w/o LF */ |
| 51 |
|
short *sp; /* character spacing */ |
| 122 |
|
exit(1); |
| 123 |
|
} |
| 124 |
|
/* load font file */ |
| 129 |
– |
if ((libpath = getenv(ULIBVAR)) == NULL) |
| 130 |
– |
libpath = DEFPATH; |
| 125 |
|
ourfont = getfont(fontfile); |
| 126 |
|
/* get text */ |
| 127 |
|
if (an == argc) |
| 134 |
|
/* convert text to bitmap */ |
| 135 |
|
maptext(); |
| 136 |
|
/* print header */ |
| 137 |
+ |
newheader("RADIANCE", stdout); |
| 138 |
|
printargs(argc, argv, stdout); |
| 139 |
|
fputformat(COLRFMT, stdout); |
| 140 |
|
putchar('\n'); |
| 163 |
|
else |
| 164 |
|
xsiz = ysiz/pictaspect + 0.5; |
| 165 |
|
cheight = ysiz/nlines; |
| 166 |
< |
cwidth = cheight/aspect + 0.5; |
| 166 |
> |
cwidth = cheight/aspect; |
| 167 |
|
} else { |
| 168 |
|
if (ysiz <= 0) |
| 169 |
|
ysiz = cheight*nlines; |
| 170 |
|
pictaspect = (double)ysiz/xsiz; |
| 171 |
|
aspect = pictaspect*maxwidth/(256*nlines); |
| 172 |
|
cheight = ysiz/nlines; |
| 173 |
< |
cwidth = cheight/aspect + 0.5; |
| 173 |
> |
cwidth = cheight/aspect; |
| 174 |
|
} |
| 175 |
|
} else { /* reverse orientation */ |
| 176 |
|
if (ysiz <= 0) { |
| 186 |
|
else |
| 187 |
|
xsiz = ysiz/pictaspect + 0.5; |
| 188 |
|
cheight = xsiz/nlines; |
| 189 |
< |
cwidth = cheight/aspect + 0.5; |
| 189 |
> |
cwidth = cheight/aspect; |
| 190 |
|
} else { |
| 191 |
|
if (xsiz <= 0) |
| 192 |
|
xsiz = cheight*nlines; |
| 193 |
|
pictaspect = (double)ysiz/xsiz; |
| 194 |
|
aspect = maxwidth/(256*nlines*pictaspect); |
| 195 |
|
cheight = xsiz/nlines; |
| 196 |
< |
cwidth = cheight/aspect + 0.5; |
| 196 |
> |
cwidth = cheight/aspect; |
| 197 |
|
} |
| 198 |
|
} |
| 199 |
|
if (xsiz % SSS) |
| 211 |
|
gettext(fp) /* get text from a file */ |
| 212 |
|
FILE *fp; |
| 213 |
|
{ |
| 219 |
– |
char *fgets(); |
| 214 |
|
char buf[MAXLINE]; |
| 215 |
|
register LINE *curl; |
| 216 |
|
int len; |
| 233 |
|
curl->s[len] = '\0'; |
| 234 |
|
if (spacing < -1./256.) |
| 235 |
|
len = squeeztext(curl->sp, curl->s, ourfont, |
| 236 |
< |
(int)(spacing*-256.0)); |
| 236 |
> |
(int)(spacing*-256.)); |
| 237 |
|
else if (spacing > 1./256.) |
| 238 |
|
len = proptext(curl->sp, curl->s, ourfont, |
| 239 |
< |
(int)(spacing*256.0), 3); |
| 239 |
> |
(int)(spacing*256.), 3); |
| 240 |
|
else |
| 241 |
|
len = uniftext(curl->sp, curl->s, ourfont); |
| 242 |
|
if (len > maxwidth) |
| 274 |
|
ourtext->sp = (short *)malloc(sizeof(short)*(maxline+1)); |
| 275 |
|
if (ourtext->sp == NULL) |
| 276 |
|
goto memerr; |
| 277 |
< |
if (spacing < 0.0) |
| 277 |
> |
if (spacing < -1./256.) |
| 278 |
|
maxwidth = squeeztext(ourtext->sp, ourtext->s, ourfont, |
| 279 |
< |
(int)(spacing*-256.0)); |
| 280 |
< |
else if (spacing > 0.0) |
| 279 |
> |
(int)(spacing*-256.)); |
| 280 |
> |
else if (spacing > 1./256.) |
| 281 |
|
maxwidth = proptext(ourtext->sp, ourtext->s, ourfont, |
| 282 |
< |
(int)(spacing*256.0), 3); |
| 282 |
> |
(int)(spacing*256.), 3); |
| 283 |
|
else |
| 284 |
|
maxwidth = uniftext(ourtext->sp, ourtext->s, ourfont); |
| 285 |
|
nlines = 1; |