157 static char sPSBuff[200];
158 static REAL sTextHeight = 10.0;
193 struct tm *time_struc;
199 fputs(
"%!PS-Adobe-2.0\n",
gPSFile);
203 fputs(
"%%For: (Andrew Martin Support Library)\n",
gPSFile);
204 sprintf(sPSBuff,
"%%%%Title: (%s)\n",FName);
207 time_struc = localtime(&time_value);
208 sprintf(sPSBuff,
"%%%%CreationDate: %s",asctime(time_struc));
211 fputs(
"%%DocumentFonts: atend\n",
gPSFile);
213 fputs(
"%%EndComments\n",
gPSFile);
215 fputs(
"%%---------------Prologue-----------------\n",
gPSFile);
217 sprintf(sPSBuff,
"/xpicsize %7.4f def\n",
PSxpicsize);
219 sprintf(sPSBuff,
"/ypicsize %7.4f def\n",
PSypicsize);
222 sprintf(sPSBuff,
"/xoffset %7.4f def\n",
PSxoffset);
224 sprintf(sPSBuff,
"/yoffset %7.4f def\n",
PSyoffset);
227 fputs(
"/xscale { xpicsize 72 mul mul } def\n",
gPSFile);
228 fputs(
"/yscale { ypicsize 72 mul mul } def\n",
gPSFile);
229 fputs(
"/xunits { xscale xoffset 72 mul add } def\n",
gPSFile);
230 fputs(
"/yunits { yscale yoffset 72 mul add } def\n\n",
gPSFile);
235 fputs(
" findfont exch scalefont setfont\n",
gPSFile);
239 fputs(
"/rightJustifyText\n",
gPSFile);
240 fputs(
"{ /RightColumn exch def\n",
gPSFile);
242 fputs(
" stringwidth pop\n",
gPSFile);
243 fputs(
" RightColumn exch sub\n",
gPSFile);
244 fputs(
" Line moveto\n",
gPSFile);
250 fputs(
"{ 0 360 arc\n",
gPSFile);
255 fputs(
"{ sTextHeight 1.5 div FontName font\n",
gPSFile);
256 fputs(
" 0 sTextHeight 2 div rmoveto\n",
gPSFile);
258 fputs(
" 0 sTextHeight 2 div neg rmoveto\n",
gPSFile);
259 fputs(
" sTextHeight FontName font\n",
gPSFile);
264 fputs(
"{ sTextHeight 1.5 div FontName font\n",
gPSFile);
265 fputs(
" 0 sTextHeight 4 div neg rmoveto\n",
gPSFile);
267 fputs(
" 0 sTextHeight 4 div rmoveto\n",
gPSFile);
268 fputs(
" sTextHeight FontName font\n",
gPSFile);
273 fputs(
"{ AltFontName findfont sTextHeight scalefont setfont\n",
276 fputs(
" sTextHeight FontName font\n",
gPSFile);
280 sprintf(sPSBuff,
"/AltFontName /%s def\n",AltFont);
286 fputs(
" lt {exch} if\n",
gPSFile);
290 fputs(
"%%EndProlog\n",
gPSFile);
292 fputs(
"%%---------------Script-----------------\n",
gPSFile);
311 sprintf(sPSBuff,
"%f setlinewidth\n",thickness);
331 sprintf(sPSBuff,
"%7.4f xunits %7.4f yunits moveto\n",X,Y);
351 sprintf(sPSBuff,
"%7.4f xunits %7.4f yunits lineto\n",X,Y);
368 sprintf(sPSBuff,
"[%s] 0 setdash\n",linepatt);
384 fputs(
"[] 0 setdash\n",
gPSFile);
425 if(!strncmp(font,
"TIMES",5))
428 strcpy(fontname+5,
"-Roman\0");
433 sprintf(sPSBuff,
"/sTextHeight %f def\n",size);
436 fputs(
"sTextHeight FontName font\n",
gPSFile);
462 sprintf(sPSBuff,
"%7.4f xunits\n",X);
464 sprintf(sPSBuff,
"/Line %7.4f yunits def\n",Y);
466 fputs(
"Line moveto\n",
gPSFile);
498 while(*buffer ==
' ') buffer++;
505 "%7.4f yunits 2 sub /Line exch def\n",Y);
509 fputs(
"dup stringwidth pop 2 div\n",
gPSFile);
511 sprintf(sPSBuff,
"%7.4f xunits exch sub\n",X);
517 fputs(
"Line moveto pop\n",
gPSFile);
521 sprintf(sPSBuff,
"Line sTextHeight %7.4f mul sub moveto pop\n",
554 sprintf(sPSBuff,
"/Line %7.4f yunits sTextHeight 2 div sub 2 \
558 sprintf(sPSBuff,
"(%s)\n",label);
561 sprintf(sPSBuff,
"%7.4f xunits 4 sub %f add rightJustifyText\n",
588 sprintf(sPSBuff,
"%7.4f xunits\n",X);
590 sprintf(sPSBuff,
"/Line %7.4f yunits sTextHeight 2 div sub 2 \
593 fputs(
"Line moveto\n",
gPSFile);
628 while(*buffer ==
' ') buffer++;
635 "sTextHeight %7.4f yunits exch sub /Line exch def\n",Y);
639 sprintf(sPSBuff,
"dup stringwidth pop 2 div\n");
642 sprintf(sPSBuff,
"%7.4f xunits exch sub\n",X);
648 fputs(
"Line moveto pop\n",
gPSFile);
652 sprintf(sPSBuff,
"Line %7.4f add moveto pop\n",Offset);
703 fputs(
"stringwidth pop 2 div\n",
gPSFile);
706 sprintf(sPSBuff,
"%7.4g yunits exch sub\n",y);
713 sprintf(sPSBuff,
"%7.4g xunits (%s) stringwidth pop sub 5 sub %f \
714 add exch moveto\n",x,label,xoff);
721 fputs(
"pop 90 rotate ",
gPSFile);
723 fputs(
" -90 rotate\n",
gPSFile);
745 for(i=0, j=0; i<strlen(text) && j<
MAXBUFF-1; i++)
754 sprintf(sPSBuff,
"(%s) show ",buffer);
759 sprintf(sPSBuff,
"(%c) greek ",text[++i]);
767 sprintf(sPSBuff,
"(%s) show ",buffer);
773 while(text[++i] !=
'}' && text[i] !=
'\0' && j<MAXBUFF-1)
774 buffer[j++] = text[i];
776 buffer[j++] = text[i];
781 sprintf(sPSBuff,
"(%s) raise ",buffer);
791 sprintf(sPSBuff,
"(%s) show ",buffer);
797 while(text[++i] !=
'}' && text[i] !=
'\0' && j<MAXBUFF-1)
798 buffer[j++] = text[i];
800 buffer[j++] = text[i];
805 sprintf(sPSBuff,
"(%s) lower ",buffer);
814 buffer[j++] = text[i];
822 sprintf(sPSBuff,
"(%s) show ",buffer);
827 if(strlen(text)) fputs(
"\n",
gPSFile);
865 font[0] = toupper(font[0]);
867 for(i=1;i<strlen(font);i++)
868 font[i] = tolower(font[i]);
870 for(i=1;i<strlen(font);i++)
874 font[i+1] = toupper(font[i+1]);
876 if(!strncmp(font+i,
"oblique",7))
877 font[i] = toupper(font[i]);
879 if(!strncmp(font+i,
"italic",6))
880 font[i] = toupper(font[i]);
882 if(!strncmp(font+i,
"roman",5))
883 font[i] = toupper(font[i]);
885 if(!strncmp(font+i,
"bold",4))
886 font[i] = toupper(font[i]);
void blPSLCText(REAL X, REAL Y, char *label)
Include file for PostScript routine.
void blPSSetDash(char *linepatt)
char * blPSCorrectCase(char *font)
void blStringToUpper(char *string1, char *string2)
void blPSThick(REAL thickness)
void blPSFont(char *fontname, REAL size)
char * blSimplifyText(char *string)
void blPSLText(REAL X, REAL Y, char *label)
void blPSVText(REAL x, REAL y, REAL xoff, char *text, char *font, REAL size, char *label, char *lfont, REAL lsize)
Include file for using plotting routines.
void blPSCBText(REAL X, REAL Y, REAL Offset, char *label)
void blPSShowText(char *text)
void blPSROffText(REAL X, REAL Y, REAL offset, char *label)
void blPSDraw(REAL X, REAL Y)
Header file for general purpose routines.
System-type variable type definitions.
void blPSMove(REAL X, REAL Y)
BOOL blPSInit(char *FName, char *creator, char *AltFont)
void blPSCTText(REAL X, REAL Y, REAL Offset, char *label)
Type definitions for maths.