[comp.lang.postscript] Template maker

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (02/20/91)

%
% makes function key templates for the pc
%
% Copyrighted 1990 by Woody Baker
% Permission to use is here by granted, provided this header remains
% intact, and no charge is made for the useage of this code.  All commercial
% rights are reserved. This means that you are free to use it, but not
% sell it.
% Woody Baker
% Rt.1 Box I
% Manor, TX. 78653

%
/ptsize 8 def
/normal {/Helvetica findfont ptsize scalefont setfont }  def
/shifted {/Helvetica-Bold findfont ptsize scalefont setfont } def
/ctrl   {/Helvetica-Oblique findfont ptsize scalefont setfont }  def
/alt   {/Helvetica-BoldOblique findfont ptsize scalefont 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 boardre
/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
	   grestore
	0  setgray stroke
	/bw inwid def
	/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
	/l21 exch def
	/l22 exch def
	/l23 exch def
	/l24 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
	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
	} def
%
%
% Replace the texts in the (....) with what you wish to have
% printed.
%
	
dotemp
(Alt f10) (Ctrl f10) (Shifted f10) (F10)
(Alt f9)  (Ctrl f9)  (Shifted f9)  (F9)
1.35 do2blocks % measure is in inches
(Alt f8) (Ctrl f8) (Shifted f8) (F8)
(Alt f7) (Ctrl f7) (Shifted f7) (F7)
2.20 do2blocks
(Alt f6) (Ctrl f6) (Shifted f6) (F6)
(Alt f5) (Ctrl f5) (Shifted f5) (F5)
2.95 do2blocks
(Alt f4) (Ctrl f4) (Shifted f4) (F4)
(Alt f3) (Ctrl f3) (Shifted f3) (F3)
3.70 do2blocks
(Alt f2) (Ctrl f2) (Shifted f2) (F2)
(Alt f1) (Ctrl f1) (Shifted f1) (F1)
4.45 do2blocks
leftofset 40 moveto normal (Fn Normal) 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
showpage
stop


Cheers
Woody

leoh@hardy.hdw.csd.harris.com (Leo Hinds) (02/21/91)

This template works nicely for the PC (function keys on the right) ... anyone 
have anything for the 101 style keyboard?


leoh@hdw.csd.harris.com         	Leo Hinds       	(305)973-5229
Gfx ... gfx ... :-) whfg orpnhfr V "ebg"grq zl fvtangher svyr lbh guvax V nz n
creireg ?!!!!!!? ... znlor arkg gvzr