[comp.lang.postscript] Postscript Doorsign maker

danjudd@thor.acc.stolaf.edu (Dan Judd) (01/23/90)

I wrote this a while back so I could fill in the "YOUR NAME HERE"
slots next to my office door. I ended up making signs for a large part
of the department, plus some for people where my wife works. I would recommend
printing it out so you know which strings to change to what. If you want
things centered etc you have to do it by hand, I didn't feel like 
adding code to make it automatic (lazy).

Dan Judd
danjudd@thor.acc.stolaf.edu
Just tryin' to put a bit of PostScript back in comp.lang.postscript :-)

----------------Cut here for PostScript------------------
%! 
%A Door Sign creator 
%by Dan Judd
%
%Change the various strings to what you want
%the named constants should be more or less self
%explanitory
%
%User  value defs
% 
/fname (First  ) def
/lname (Last  ) def
/backstring (Background String ) def
/boxht 210 def
%/boxwd 150 def
/boxwd 360 def
/backht boxht 3 mul 100 add def
/backwd boxwd 20 add def
/backstrht 4 def
/backpoint 4 def
/shadelight 1 def
/shadedark 0 def
/shadelevels 33 def
/shadexdist 33 def
/shadeydist  -15 def

%
%User procedure defs
%
/line1 (This is Line One!) def
/line2 (This is Line Two!) def
/phrase {5 60 moveto  line1  show
 5 20 moveto line2  show
  }def

/phraseoutline { line1 5 60  loutline
 line2  5 20   loutline
  }def

/box {0 0 moveto 0 boxht rlineto  boxwd 0
 rlineto  0  boxht -1 mul rlineto closepath stroke 
stroke}  bind def

/logo { gsave
 box
.3 setlinewidth
/Times-Bold findfont 60 scalefont setfont
fname 5 150 loutline
lname 5 100 loutline
/Times-BoldItalic findfont 40 scalefont setfont
 /phrase load dshade
 phraseoutline 
 grestore} bind def

%
% Begin procedure library set
%
% usage string x y [ld]outline
/loutline { 3 copy 1 setgray
 moveto true charpath fill
0 setgray
 moveto false charpath stroke} bind def

/doutline { 3 copy 0 setgray
 moveto true charpath fill
1 setgray
 moveto false charpath stroke} bind def

/background {
/Times-Italic findfont backpoint scalefont setfont
0 setgray 
-10 -10 moveto backwd -10 lineto backwd backht lineto 
-10 backht lineto -10 -10 lineto fill
1 setgray
/strlen backstring stringwidth pop cvi def
/numstrings backwd strlen div ceiling cvi 2 add  def
-10 backstrht backht { dup strlen mod -1 mul 20 sub
 exch moveto
numstrings { backstring show } repeat } for
 } def

%Usage {procedure def that prints}[dl]shade
/dshade { gsave /USERPHRASE exch def
  /xshift shadexdist shadelevels div -1 mul def
  /yshift shadeydist shadelevels div -1 mul def
  /grayshift shadelight shadedark sub shadelevels div def
  /curgray shadelight def
  shadexdist shadeydist translate
  shadelevels 1 sub {
    curgray setgray USERPHRASE
    /curgray curgray grayshift sub def
    xshift yshift translate } repeat
 grestore  shadedark setgray
   USERPHRASE } def

/lshade { gsave /USERPHRASE exch def
  /xshift shadexdist shadelevels div -1 mul def
  /yshift shadeydist shadelevels div -1 mul def
  /grayshift shadedark shadelight sub shadelevels div def
  /curgray shadedark def
  shadexdist shadeydist translate
  shadelevels 1 sub {
    curgray setgray USERPHRASE
    /curgray curgray grayshift sub def
    xshift yshift translate } repeat
  grestore shadelight setgray
  USERPHRASE } def
%
%Begin execution
%
30 30 translate
background
logo
0 boxht 25 add translate logo
0 boxht 25 add translate logo
showpage