Article View: comp.lang.postscript
Article #7594PostsCrap code that might be useable
From: James Salsman
Date: Wed, 09 Nov 1988 01:46
Date: Wed, 09 Nov 1988 01:46
75 lines
2633 bytes
2633 bytes
First, a definition for '?' that can help with debugging your
.ps code:
%! debug-op with example
%
/? {dup 50 string cvs print (: ) print load ==} bind def % debug-op
%
/Foo 20 def
%
/Foo ?
%
%output: "Foo: 20" <cr>
Theory of operation: you stick in quoted identifiers with question marks
and the interpreter prints out their values to %stdout (your printer's
error log?)
And, for those of you with Linos:
%!LinoPoster
% for use only on a Linotronic 100/300
% by James P. Salsman (jps@CAT.CMU.EDU)
%
/TheMessage (DON'T PANIC) def % what the poster will say
/TheFont /Bookman-Demi def % what it will say it in; don't use Times
%
/inch {72 mul} def % trusty inch macro
%
/MessageHeight 11 inch def % the vertical space to be used for the message
/PageLength 8 inch def % larger numbers take less time but waste more paper
%
/MaxPhysWidth 842 def % maximum paper "width," 11.7 inches
%
statusdict begin % to modify page parameters
MaxPhysWidth % width
PageLength % height
0 % offset
0 % orientation (map logical width to physical length)
setpageparams
end
%
TheFont findfont setfont % get the font in units
0 0 moveto % go to the origin
TheMessage false charpath % path of the message -- do NOT flattenpath!
pathbbox % message's bbox
/Top exch def % ur(y)
/Rgt exch def % ur(x)
/Bot exch def % ll(y)
/Lft exch def % ll(x)
%
/HeightUnits Top Bot sub def % height in units
/Factor MessageHeight HeightUnits div def % scaling factor (and point size)
/Pages Rgt Lft sub Factor mul PageLength div floor def % length in pages-1
/CenterOffset MaxPhysWidth MessageHeight sub 2 div def
/VertOrigin Bot neg Factor mul def % bbox origin y coord
/HorzOrigin Lft neg Factor mul def % bbox origin x coord
%
currentfont Factor scalefont setfont % scale font up
%
0 1 Pages { % for: iterate from 0 by 1 to pages-1
PageLength mul neg % adjust for the current page frame
CenterOffset translate % and the centering
HorzOrigin VertOrigin moveto % go to the origin for the bbox
TheMessage show % paint letters
showpage % record page
} for
%
% end
That should be obvious. It makes REALLY BIG letters. I mean HUGE!
--
:James P. Salsman (jps@CAT.CMU.EDU)
--
Technical Details
Message-ID:
<3519@pt.cs.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!labrea!rutgers!mailrus!bbn!rochester!pt.cs.cmu.edu!cat.cmu.edu!jpsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!labrea!rutgers!mailrus!bbn!rochester!pt.cs.cmu.edu!cat.cmu.edu!jps From: jps@cat.cmu.edu (James Salsman) Newsgroups: comp.lang.postscript Subject: PostsCrap code that might be useable Summary: stupid programs Message-ID: <3519@pt.cs.cmu.edu> Date: 9 Nov 88 01:46:49 GMT Organization: Carnegie Mellon Lines: 73