woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (07/14/90)
Here is another one of those off the wall things that I like to write.
This one will printout a template for the function keys on an 84 key
AT style keyboard. It was done because I lost the template for my
copy of MS-word.
Enjoy
Cheers
Woody
%
% makes function key templates for the pc 10 FKEY keyboard.
% (c) copyright 1988 woody baker. All commercial rights reserved.
% you are free to use this code to create templates for your own or
% department use, but resale of this code is forbidden.
%
%
% this example is for MS-word
%
%
% you may have to change the font name if your printer does not
% support Helvetic-Narrow.
%
% In that case, change it to Helvetica, and change the scalefonts
% to makefonts, with a hight of 8 and a width of 6.5 or so....
%
/ptsize 8 def
/normal {/Helvetica-Narrow findfont ptsize scalefont setfont } def
/shifted {/Helvetica-Narrow-Bold findfont ptsize scalefont setfont } def
/ctrl {/Helvetica-Narrow-Oblique findfont ptsize scalefont setfont } def
/alt {/Helvetica-Narrow-BoldOblique findfont ptsize scalefont setfont } def
/bakward {/Helvetica-Narrow findfont [8 0 -2.25 8 0 0 ]makefont setfont } def
/inches
{
72 mul
} def
/width 3.0625 inches def % width of template
/hite 4.75 inches def % temp height
/inwid 1.500 inches def % inner space width
/inhite 3.770 inches def % hite of inner space
/leftofset 1.360 inches def %left "margin" for inner cutout
/botofset .75 inches def % bottom margin for inner cutout
/bl 0 def
/bw width def
/bt hite def
/rad 10 def
/tmgray 1 def % 1=white
/letborder 0 def % black boarder
/letback 1 def % white background
/lineleft leftofset 2 div def % vertical line left margin
/linehite 3.875 inches def
/ljtext 3 def
/ljtext2 lineleft 3 add def
/fhite
{
gsave
newpath % find the height of the character in font
0 0 moveto
(1) true charpath flattenpath pathbbox
/xhite exch def
pop pop pop newpath
grestore
/xhite 10 def
} def
%
% this routine computes the height of the font
% and creates a white box that is a bit taller, centered around
% the y coordinate. it will be a bit wider than the text to be
% printed so that the text will be set in it.
%
% parameters in are x y (string) fbox where x and y are the
% coordinates for the text to start, and string is the string to
% print and fbox is the routine to do the font box
%
/fbox
{
/workstring exch def
/ycoord exch def
/xcoord exch def
fhite
workstring stringwidth pop
/wide exch def % remove this line and
/wide wide 1.2 mul def % set wide to a value for all
letborder setgray % labels to be same width
xhite 1.4 mul setlinewidth % create a line segment width
1 setlinecap
xcoord ycoord moveto
xcoord wide add ycoord lineto stroke
xhite 1.1 mul setlinewidth letback setgray
xcoord ycoord moveto
xcoord wide add ycoord lineto stroke
0 setgray
xcoord ycoord xhite 1.1 mul 3 div sub moveto
workstring show
} def
/box
{
/br bl bw add def
/bh bt bl sub def
/bb bt bh sub def
/strt br bl add 2 div def
strt bt moveto br bt br bb rad arcto
br bb bl bb rad arcto % do arced corners with straight lines
bl bb bl bt rad arcto
bl bt strt bt rad arcto
closepath
} def
100 100 translate % pick a spot on the page
/dotemp
{
gsave
0 0 moveto box
gsave
tmgray setgray fill % color the template in
grestore
0 setgray stroke
/bw inwid def % set up box width
/bt inhite def
leftofset botofset translate
box
gsave
1 setgray fill
grestore
gsave
0 setgray stroke
grestore
clear
grestore
gsave
lineleft botofset translate
0 0 moveto
0 linehite lineto stroke % vert line
grestore
0 1.4 inches moveto leftofset 1.4 inches lineto stroke
0 2.25 inches moveto leftofset 2.25 inches lineto stroke
0 3 inches moveto leftofset 3 inches lineto stroke
0 3.75 inches moveto leftofset 3.75 inches lineto stroke
clear
} def
%
% ljtext is left margin for left column
% ljtext2 is left margin for 2nd column
%
/do2blocks
{
/ver exch def %vertical spot
/l1 exch def
/l2 exch def % text lines
/l3 exch def % simple code is better
/l4 exch def
/l5 exch def
/l21 exch def
/l22 exch def
/l23 exch def
/l24 exch def
/l25 exch def
normal ljtext ver inches ptsize sub moveto l1 show
shifted ljtext ver inches ptsize 2 mul sub moveto l2 show
ctrl ljtext ver inches ptsize 3 mul sub moveto l3 show
alt ljtext ver inches ptsize 4 mul sub moveto l4 show
bakward ljtext ver inches ptsize 5 mul sub moveto l5 show
normal ljtext2 ver inches ptsize sub moveto l21 show
shifted ljtext2 ver inches ptsize 2 mul sub moveto l22 show
ctrl ljtext2 ver inches ptsize 3 mul sub moveto l23 show
alt ljtext2 ver inches ptsize 4 mul sub moveto l24 show
bakward ljtext2 ver inches ptsize 5 mul sub moveto l25 show
} def
%
% do actual template
%
dotemp
(Prev. Char.) (Record Style) (Save) (Whole Doc) (Next para.)
(Next Char) (Text/Graph.) (Repaginate) (Current line) (Prev. para)
1.35 do2blocks % measure is in inches
(Next Word)(Font Name) (Print) (Next Sent.) (Next Word)
(Prev. Word) (Printer disp.) (Load) (Prev. Sent.) (Prev. Word)
2.20 do2blocks
()(Spell) (Thesaurus) (Col Select) (Ext. Select)
()(Go to Page) (Line Draw) (Outline org.) (Overtype)
2.95 do2blocks
()(Set Margins) (Update List) (Repeat Srch) (Repeat Edit)
()(Copy to Scrap) (Step Macro) (Record Macro) (Glossary)
3.70 do2blocks
()(Footer) (Header) (Outline View) (Calculate)
(List Choices)(Set Tab) (Zoom Win.) (Undo) (Next Window)
4.45 do2blocks
leftofset 40 moveto normal (Fn only) show
leftofset 40 ptsize sub moveto shifted (Fn + Shift) show
leftofset 40 ptsize 2 mul sub moveto ctrl (Fn + Ctrl) show
leftofset 40 ptsize 3 mul sub moveto alt (Fn + Alt) show
leftofset 40 ptsize 4 mul sub moveto
bakward (effect in menus or command fields) show
showpage
stop