home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / ps / keyboard < prev    next >
Text File  |  1991-04-25  |  5KB  |  144 lines

  1. %%!PS-Adobe-1.0
  2. %
  3. % template.ps
  4. % Print an IBM PC/XT/AT Enhanced Keyboard template.
  5. % This code will print 4 keyboard templates per page
  6. % for keyboards that have 12 function keys in groups of 
  7. % four along the top of the keyboard.
  8. %
  9. % To use: Define the TITLE and fill in each of the 4
  10. % arrays fkey (Function Key Only), skey (Shift Function Key),
  11. % akey (Alt Function Key), and ckey (Ctrl Function Key).
  12. %
  13. % NOTE: be sure to leave all 13 elements of each array defined.
  14. %
  15. % This code may be used freely and without compensation to the
  16. % author for personal and private use. 
  17. % This code may not be included in any program for which a fee is 
  18. % charged without the express written permission of the author.
  19. %
  20. %                       (c) 1991 Data Services
  21. %                          P.O. Box 901906
  22. %                  Palmdale, California  93590-1906
  23. %                         leggedav@cerf.net
  24. %
  25. %-----------------------------------------------------
  26. % Define the variables
  27. %-----------------------------------------------------
  28. /LM .25 def        % Right Margin
  29. /BM .25  def        % Bottom Margin
  30. /b1strt  .6375 def    % Box #1 start
  31. /b2strt 4.0125 def    % Box #2 start
  32. /b3strt 7.3875 def    % Box #3 start
  33. /txtstartln .31736 def  % Starting position of text bottom line
  34. /keysperbox 4 def    % # of keys to each box
  35. /boxlen     3 def         % Lenhgth of each box
  36. /boxdist  b2strt boxlen sub b1strt sub def % Distance from end of box to next
  37. /TITLE (Title:) def
  38. %------------------------------------------------------
  39. % Function Key Only Text F1 -> F12 all must be defined
  40. %------------------------------------------------------
  41. /fkey [(     F1     ) (     F2     ) (     F3     ) (     F4     )
  42.        (     F5     ) (     F6     ) (     F7     ) (     F8     ) 
  43.        (     F9     ) (     F10    ) (     F11    ) (     F12    )
  44.        (Key)] def
  45. %------------------------------------------------------
  46. % Shift Function Key
  47. %------------------------------------------------------
  48. /skey [(     F1     ) (     F2     ) (     F3     ) (     F4     )
  49.        (     F5     ) (     F6     ) (     F7     ) (     F8     ) 
  50.        (     F9     ) (     F10    ) (     F11    ) (     F12    )
  51.        (Shift)] def
  52. %------------------------------------------------------
  53. % Alt Function Key
  54. %------------------------------------------------------
  55. /akey [(     F1     ) (     F2     ) (     F3     ) (     F4     )
  56.        (     F5     ) (     F6     ) (     F7     ) (     F8     ) 
  57.        (     F9     ) (     F10    ) (     F11    ) (     F12    )
  58.        (Alt)] def
  59. %------------------------------------------------------
  60. % Ctrl Function Key
  61. %------------------------------------------------------
  62. /ckey [(     F1     ) (     F2     ) (     F3     ) (     F4     )
  63.        (     F5     ) (     F6     ) (     F7     ) (     F8     ) 
  64.        (     F9     ) (     F10    ) (     F11    ) (     F12    )
  65.        (Ctrl)] def
  66. %------------------------------------------------------
  67. % Define the Procedures
  68. % -----------------------------------------------------
  69. /I {72 mul} def
  70. /B {newpath
  71.      moveto 
  72.      0  .75 I  rlineto
  73.      boxlen I  0    rlineto
  74.      0 -.75  I rlineto
  75.       closepath
  76.     stroke } def
  77. /S {newpath
  78.     moveto
  79.     10.5 I 0 rlineto
  80.     11 setlinewidth
  81.     .995 setgray
  82.     stroke } def    
  83. /TXTPRT {ptr get dup
  84.          curx I cury I moveto show
  85.          /curx curx .75 add def            % Incrament x pointer
  86.          /ptr ptr 1 add def             % Add 1 to array pointer
  87.          ptr keysperbox mod 0 eq                % Check if at the end of a box
  88.          {/curx curx boxdist add def} if        % Skip to next box
  89.          ptr 12 eq                 % Look for key label 
  90.          {/curx curx boxdist sub def} if } def  % do not skip for last item
  91. %--------------------------------------------------------------
  92. % Draw the outside box and outlines for the keys
  93. %--------------------------------------------------------------
  94. /BOX {
  95.   newpath
  96.   LM I BM I moveto
  97.   0 1.688 I rlineto
  98.   10.5 I 0 rlineto
  99.   0 -1.688 I rlineto closepath
  100.   1 setlinewidth
  101.   stroke 
  102.   b1strt I .9375 I B
  103.   b2strt I .9375 I B 
  104.   b3strt I .9375 I B
  105.   LM I .50625 I S
  106.   LM I .81875 I S
  107.   0 setgray } def
  108. %-------------------------------------------------------------
  109. %Print the text
  110. %-------------------------------------------------------------
  111. /TEXT {
  112.   /Courier findfont 7 scalefont setfont
  113.   /curx b1strt def
  114.   /cury txtstartln def
  115.   /ptr  0 def
  116.   13 {ckey TXTPRT} repeat
  117.   /curx b1strt def
  118.   /cury txtstartln .15 add def
  119.   /ptr  0 def
  120.   13 {akey TXTPRT} repeat
  121.   /curx b1strt def
  122.   /cury txtstartln .30 add def
  123.   /ptr  0 def
  124.   13 {skey TXTPRT} repeat
  125.   /curx b1strt def
  126.   /cury txtstartln .45 add def
  127.   /ptr  0 def
  128.   13 {fkey TXTPRT} repeat
  129.   b1strt I 1.8 I moveto
  130.   TITLE show
  131. } def
  132. %--------------------------------------------------------------
  133. % Set-up the page
  134. %--------------------------------------------------------------
  135. 2.5 I 0 translate
  136. 90 rotate
  137. 4 {
  138.   BOX
  139.   TEXT
  140.   0 -2 I translate } repeat
  141. showpage
  142.  
  143.