Article View: comp.lang.postscript
Article #8539Re: 'draft' background for documents
From: Ben Cranston
Date: Wed, 07 Jun 1989 17:57
Date: Wed, 07 Jun 1989 17:57
47 lines
2195 bytes
2195 bytes
This is not the version that was posted a month ago; if anybody is sending
that to the original poster please mail to me also. This is just the code
to actually do it, one could wrap it in a redefined showpage to do it for
each page in a postscript file.
This code takes an arbitrary string and an arbitrary rectangle. There is
some strange interaction with the setscreen stuff that makes the orientation
of the screen a little off from the orientation of the text. If ANYBODY can
suggest a way to fix this I would be quite grateful!
Anyway, you translate to the lower left corner of the rectangle, then push
the coordinates of the upper right corner and the text onto the stack. Then
you call the "sash" operator. See the test program at the end.
%!PS-Adobe
% width height (string) sash
% ----
/sash {
gsave
3 1 roll 2 copy exch atan
neg currentscreen 3 1 roll pop 3 -2 roll setscreen
currentscreen pop neg 5 1 roll pop
2 div exch dup 3 1 roll 2 div exch translate
/Helvetica-Bold findfont dup setfont 4 1 roll
1 index stringwidth pop div 2 index cos div .8 mul
4 -1 roll 1 index scalefont setfont 3 -1 roll rotate
exch dup stringwidth pop -2 div 3 -1 roll -2.5 div moveto
.9 setgray show
grestore
} bind def
% main program
gsave
25 25 translate
500 700 (EXECUTIVE) sash
newpath
0 0 moveto 0 700 lineto 500 700 lineto 500 0 lineto closepath
stroke
grestore
showpage
--
Ben Cranston <zben@umd2.UMD.EDU> (Kingdom of Merryland UniSys 1100/92)
Copyright 1989 (you may redistribute ONLY if your recipients can).
Technical Details
Message-ID:
<4974@umd5.umd.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!mailrus!uflorida!haven!umd5!zbenReferences:
<919D025R327r01@amdahl.uts.amdahl.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!mailrus!uflorida!haven!umd5!zben From: zben@umd5.umd.edu (Ben Cranston) Newsgroups: comp.lang.postscript Subject: Re: 'draft' background for documents Summary: Sash - another version of banner printer Keywords: background shadow outline Message-ID: <4974@umd5.umd.edu> Date: 7 Jun 89 17:57:50 GMT References: <919D025R327r01@amdahl.uts.amdahl.com> Reply-To: zben@umd5.umd.edu (Ben Cranston) Distribution: usa Organization: University of Maryland, College Park Lines: 47