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"; |
66 |
|
int maxwidth; /* maximum line width (dvi) */ |
67 |
|
|
68 |
|
extern char *getenv(); |
69 |
– |
extern char *malloc(), *calloc(); |
69 |
|
|
70 |
|
|
71 |
|
main(argc, argv) |
109 |
|
goto unkopt; |
110 |
|
} |
111 |
|
break; |
112 |
+ |
case 'x': /* x resolution */ |
113 |
+ |
xsiz = atoi(argv[++an])*SSS; |
114 |
+ |
break; |
115 |
+ |
case 'y': |
116 |
+ |
ysiz = atoi(argv[++an])*SSS; |
117 |
+ |
break; |
118 |
|
case 'h': /* height of characters */ |
119 |
|
cheight = atoi(argv[++an])*SSS; |
120 |
+ |
xsiz = xsiz = 0; |
121 |
|
break; |
122 |
|
case 'a': /* aspect ratio */ |
123 |
|
aspect = atof(argv[++an]); |
158 |
|
|
159 |
|
makemap() /* create the bit map */ |
160 |
|
{ |
161 |
< |
cwidth = cheight/aspect + 0.5; |
161 |
> |
double pictaspect; |
162 |
> |
|
163 |
|
if (direct == 'r' || direct == 'l') { |
164 |
< |
xsiz = (long)maxwidth*cwidth >> 8; |
165 |
< |
ysiz = nlines*cheight; |
164 |
> |
if (xsiz == 0 || ysiz == 0) { |
165 |
> |
cwidth = cheight/aspect + 0.5; |
166 |
> |
xsiz = (long)maxwidth*cwidth >> 8; |
167 |
> |
ysiz = nlines*cheight; |
168 |
> |
} else { |
169 |
> |
pictaspect = 256*nlines*aspect/maxwidth; |
170 |
> |
if (pictaspect*xsiz < ysiz) |
171 |
> |
ysiz = pictaspect*xsiz + 0.5; |
172 |
> |
else |
173 |
> |
xsiz = ysiz/pictaspect + 0.5; |
174 |
> |
cheight = ysiz/nlines; |
175 |
> |
cwidth = cheight/aspect + 0.5; |
176 |
> |
} |
177 |
|
} else { /* reverse orientation */ |
178 |
< |
xsiz = nlines*cheight; |
179 |
< |
ysiz = (long)maxwidth*cwidth >> 8; |
178 |
> |
if (xsiz == 0 || ysiz == 0) { |
179 |
> |
cwidth = cheight/aspect + 0.5; |
180 |
> |
xsiz = nlines*cheight; |
181 |
> |
ysiz = (long)maxwidth*cwidth >> 8; |
182 |
> |
} else { |
183 |
> |
pictaspect = maxwidth/(256*nlines*aspect); |
184 |
> |
if (pictaspect*xsiz < ysiz) |
185 |
> |
ysiz = pictaspect*xsiz + 0.5; |
186 |
> |
else |
187 |
> |
xsiz = ysiz/pictaspect + 0.5; |
188 |
> |
cheight = xsiz/nlines; |
189 |
> |
cwidth = cheight/aspect + 0.5; |
190 |
> |
} |
191 |
|
} |
192 |
|
if (xsiz % SSS) |
193 |
|
xsiz += SSS - xsiz%SSS; |
194 |
|
if (ysiz % SSS) |
195 |
|
ysiz += SSS - ysiz%SSS; |
196 |
|
xdim = (xsiz+7)/8; |
197 |
< |
ourbitmap = (BYTE *)calloc(ysiz, xdim); |
197 |
> |
ourbitmap = (BYTE *)bmalloc(ysiz*xdim); |
198 |
|
if (ourbitmap == NULL) |
199 |
|
error(SYSTEM, "Out of memory in makemap"); |
200 |
+ |
bzero((char *)ourbitmap, ysiz*xdim); |
201 |
|
} |
202 |
|
|
203 |
|
|
225 |
|
maxline = len; |
226 |
|
strncpy(curl->s, buf, len); |
227 |
|
curl->s[len] = '\0'; |
228 |
< |
if (spacing < 0.0) |
228 |
> |
if (spacing < -1./256.) |
229 |
|
len = squeeztext(curl->sp, curl->s, ourfont, |
230 |
|
(int)(spacing*-256.0)); |
231 |
< |
else if (spacing > 0.0) |
231 |
> |
else if (spacing > 1./256.) |
232 |
|
len = proptext(curl->sp, curl->s, ourfont, |
233 |
|
(int)(spacing*256.0), 3); |
234 |
|
else |