liam@cs.qmc.ac.uk (William Roberts) (01/09/89)
I have finally managed to get round to sorting out the
PostScript code for psfig that gets added to the psdit.pro file.
This works OK as given, but gives problems if you have tinkered
with psdit for special effects such as 2-up printing. The
problem is that psfig does all the sort of things that
Encapsulated PostScript files aren't allowed to do, namely
reading all sorts of things like the current transformation
matrix etc. It does this *before* TranScript does its
coordinate system transformations, and so psfig has to second
guess these transformations itself.
This is clearly not the best way of doing this, so I have
modified the startFig routine so that it assumes the current
coordinate system to be troff style and works accordingly.
----------------------
%% Psfig additions - modified by WTR on 9/1/89
/startFig {
/SavedState save def
userdict maxlength dict begin
currentpoint translate % position of top-left corner
/ury exch def
/urx exch def
/lly exch def
/llx exch def
/y exch def /x exch def % desired size in troff units
/sx x urx llx sub div def % scaling for x
/sy y lly ury sub div def % scaling for y (negative for troff)
sx sy scale % scale by (sx,sy)
llx neg ury neg translate % translate to correct origin
/DefFigCTM matrix currentmatrix def
/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecap
currentlinejoin currentdash currentgray currentmiterlimit ] cvx
def
/initmatrix {
DefFigCTM setmatrix
} def
/defaultmatrix {
DefFigCTM exch copy
} def
/initgraphics {
DocumentInitState setmiterlimit setgray setdash
setlinejoin setlinecap setlinewidth setmatrix
DefFigCTM setmatrix
} def
/showpage {
initgraphics
} def
} def
% Args are llx lly urx ury (in figure coordinates)
/clipFig {
currentpoint 6 2 roll
newpath 4 copy
4 2 roll moveto
6 -1 roll exch lineto
exch lineto
exch lineto
closepath clip
newpath
moveto
} def
% doclip, if called, will always be just after a `startfig'
/doclip { llx lly urx ury clipFig } def
/endFig {
end SavedState restore
} def
/globalstart {
% Push details about the enviornment on the stack.
fontnum fontsize fontslant fontheight firstpage
mh my resolution slotno currentpoint
pagesave restore gsave
} def
/globalend {
grestore moveto
/slotno exch def /resolution exch def /my exch def
/mh exch def /firstpage exch def /fontheight exch def
/fontslant exch def /fontsize exch def /fontnum exch def
F
/pagesave save def
} def
/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
/PB{save /psv exch def currentpoint translate
resolution 72 div dup neg scale 0 0 moveto}def
/PE{psv restore}def
----------------------
--
William Roberts ARPA: liam@cs.qmc.ac.uk (gw: cs.ucl.edu)
Queen Mary College UUCP: liam@qmc-cs.UUCP
LONDON, UK Tel: 01-975 5250