--- ray/src/px/psign.c 1992/07/07 17:35:42 2.9 +++ ray/src/px/psign.c 1992/09/08 10:35:08 2.12 @@ -16,19 +16,14 @@ static char SCCSid[] = "$SunId$ LBL"; #include "font.h" +#include "paths.h" + #ifndef SSS #define SSS 3 /* super-sample size */ #endif #define MAXLINE 512 /* longest allowable line */ -#ifndef DEFPATH -#define DEFPATH ":/usr/local/lib/ray" -#endif -#ifndef ULIBVAR -#define ULIBVAR "RAYPATH" -#endif - char *fontfile = "helvet.fnt"; /* our font file */ COLOR bgcolor = WHTCOLOR; /* background color */ @@ -65,9 +60,7 @@ LINE *ourtext; /* our text */ int nlines, maxline; /* text dimensions */ int maxwidth; /* maximum line width (dvi) */ -extern char *getenv(); - main(argc, argv) int argc; char *argv[]; @@ -117,7 +110,6 @@ char *argv[]; break; case 'h': /* height of characters */ cheight = atoi(argv[++an])*SSS; - xsiz = xsiz = 0; break; case 'a': /* aspect ratio */ aspect = atof(argv[++an]); @@ -161,11 +153,13 @@ makemap() /* create the bit map */ double pictaspect; if (direct == 'r' || direct == 'l') { - if (xsiz == 0 || ysiz == 0) { + if (xsiz <= 0) { cwidth = cheight/aspect + 0.5; xsiz = (long)maxwidth*cwidth >> 8; ysiz = nlines*cheight; - } else { + } else if (aspect > FTINY) { + if (ysiz <= 0) + ysiz = cheight*nlines; pictaspect = 256*nlines*aspect/maxwidth; if (pictaspect*xsiz < ysiz) ysiz = pictaspect*xsiz + 0.5; @@ -173,18 +167,34 @@ makemap() /* create the bit map */ xsiz = ysiz/pictaspect + 0.5; cheight = ysiz/nlines; cwidth = cheight/aspect + 0.5; + } else { + if (ysiz <= 0) + ysiz = cheight*nlines; + pictaspect = (double)ysiz/xsiz; + aspect = pictaspect*maxwidth/(256*nlines); + cheight = ysiz/nlines; + cwidth = cheight/aspect + 0.5; } } else { /* reverse orientation */ - if (xsiz == 0 || ysiz == 0) { + if (ysiz <= 0) { cwidth = cheight/aspect + 0.5; xsiz = nlines*cheight; ysiz = (long)maxwidth*cwidth >> 8; - } else { + } else if (aspect > FTINY) { + if (xsiz <= 0) + xsiz = cheight*nlines; pictaspect = maxwidth/(256*nlines*aspect); if (pictaspect*xsiz < ysiz) ysiz = pictaspect*xsiz + 0.5; else xsiz = ysiz/pictaspect + 0.5; + cheight = xsiz/nlines; + cwidth = cheight/aspect + 0.5; + } else { + if (xsiz <= 0) + xsiz = cheight*nlines; + pictaspect = (double)ysiz/xsiz; + aspect = maxwidth/(256*nlines*pictaspect); cheight = xsiz/nlines; cwidth = cheight/aspect + 0.5; }