home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / showcp.zip / printcp.psh < prev    next >
Text File  |  1997-11-03  |  7KB  |  225 lines

  1. %%BeginProcSet: printcp 1.0 2
  2. % printcp (C) Copyright IBM Corp. 1995
  3. /Printcp 150 dict def
  4. Printcp begin
  5.  
  6. % customization values for size
  7. /demosize  17 def               % size of font
  8. /baseline  18 def               % position of baseline from top
  9. /below     10 def               % baseline to bottom annotation
  10. /demofont  /Times-Bold def      % font for characters
  11. /titlefont /Helvetica-Bold def  % title line font
  12. /titlesize 20 def               % title size
  13. /smallf    /Helvetica findfont 7 scalefont def
  14.  
  15. % These should not change
  16. /onebox  32 def
  17. /halfbox 16 def
  18. /char ( ) def
  19. /rasterscale 44 demosize div def
  20. /Uni 10 string def
  21. /bd {bind def} bind def
  22. /ln {lineto} bd
  23. /mt {moveto} bd
  24. /rm {rmoveto} bd
  25. /rl {rlineto} bd
  26. /st {stroke} bd
  27. /gs {gsave}  bd
  28. /chst {gsave currentpoint translate} bd
  29. /gr {grestore} bd
  30. /fl {closepath fill} bd
  31.  
  32. % We may override these later, but these are the defaults
  33. /Delta 0 def
  34. /rows 16 def
  35. /cols 16 def
  36. /col1  0 def
  37. /row1  0 def
  38.  
  39. % Define box
  40. /hline {onebox cols mul dup 0 rl neg onebox neg rm} def
  41. /vline {onebox rows mul dup neg 0 exch rl onebox exch rm} def
  42. /box {
  43.   0.5 setlinewidth
  44.   topx topy mt
  45.   0 1 rows {pop hline} for st
  46.   topx topy mt
  47.   0 1 cols {pop vline} for st
  48. } bd
  49.  
  50. % outer box.  This is optional and only adds a thicker box
  51. /obox {
  52.   topx 0.75 sub topy 0.75 add mt
  53.   1.5 setlinewidth
  54.   onebox cols mul 1.5 add dup 0 rl
  55.   0 onebox rows mul 1.5 add neg rl
  56.   neg 0 rl closepath st
  57. } bd
  58.  
  59. % codepage 819 with extra chars in the upper control area
  60. /cp819 [
  61. /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
  62. /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
  63. /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
  64. /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
  65. /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle
  66. /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash
  67. /zero/one/two/three/four/five/six/seven
  68. /eight/nine/colon/semicolon/less/equal/greater/question
  69. /at/A/B/C/D/E/F/G
  70. /H/I/J/K/L/M/N/O
  71. /P/Q/R/S/T/U/V/W
  72. /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore
  73. /grave/a/b/c/d/e/f/g
  74. /h/i/j/k/l/m/n/o
  75. /p/q/r/s/t/u/v/w
  76. /x/y/z/braceleft/bar/braceright/asciitilde/.notdef
  77. /florin/dotlessi/trademark/lslash/Lslash/oe/OE/dagger
  78. /daggerdbl/bullet1/breve/caron/ogonek/hungarumlaut/dotaccent/Eth
  79. /quotedblleft/quotedblright/scaron/Scaron/zcaron/Zcaron/circumflex/tilde
  80. /ring/quoteleft/quoteright/quotedblbase/perthousand/emdash/.notdef/bullet
  81. /space/exclamdown/cent/sterling/currency/yen/brokenbar/section
  82. /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron
  83. /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered
  84. /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown
  85. /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
  86. /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
  87. /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply
  88. /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
  89. /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
  90. /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
  91. /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide
  92. /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
  93. ] def
  94.  
  95. % Recode font
  96. /recode {
  97.   dup findfont
  98.   dup maxlength dict /nf exch def
  99.   {1 index /FID ne {nf 3 1 roll put} {pop pop} ifelse} forall
  100.   nf /Encoding cp819 put
  101.   nf definefont
  102. } bd
  103.  
  104. % Show codepoint number in decimal
  105. /cdp  {
  106.   gs
  107.   /int exch def
  108.   /dx topx j onebox mul add 20 add def
  109.   /dy y below sub def
  110.   dx dy mt
  111.   smallf setfont
  112.   int 10  lt {(0) show} if
  113.   int 100 lt {(0) show} if
  114.   int (   ) cvs show
  115.   gr
  116. } bd
  117.  
  118. % Show IBM name or unicode name
  119. /ibmn {
  120.   gs
  121.   /nam exch def
  122.   /dx x 14 add def
  123.   /dy y below sub def
  124.   dx dy mt
  125.   smallf setfont
  126.   nam dup stringwidth pop neg 0 rm show
  127.   gr
  128. } bd
  129.  
  130. % Normal labels (left to right)
  131. /label {
  132.   /Helvetica findfont 14 scalefont setfont
  133.   /y topy 7 add def
  134.   0 1 cols 1 sub {/j exch def
  135.     /x topx j onebox mul 10 add add def
  136.     x y mt (-) show
  137.     j col1 add 16 char cvrs show
  138.   } for
  139.   0 1 rows 1 sub {/i exch def
  140.     /y topy i onebox mul 23 add sub 1.7 add def
  141.     /x topx 20 sub def
  142.     x y mt
  143.     i row1 add 16 char cvrs show (-) show
  144.   } for
  145. } bd
  146.  
  147. % reversed labels (top to bottom)
  148. /revlabel {
  149.   /Helvetica findfont 14 scalefont setfont
  150.   /y topy 7 add def
  151.   0 1 cols 1 sub {/j exch def
  152.     /x topx j onebox mul 10 add add def
  153.     x y mt
  154.     j col1 add 16 char cvrs show (-) show
  155.   } for
  156.   0 1 rows 1 sub {/i exch def
  157.     /y topy i onebox mul 23 add sub 1.7 add def
  158.     /x topx 20 sub def
  159.     x y mt
  160.     (-) show i row1 add 16 char cvrs show
  161.   } for
  162. } bd
  163.  
  164. % character position
  165. /cpos {
  166.   dup /i exch def onebox mul topy exch sub baseline Delta add sub /y exch def
  167.   dup /j exch def onebox mul topx add halfbox add /x exch def
  168.   x y mt
  169. } bd
  170.  
  171. % font character
  172. /chr {
  173.   gs
  174.   char exch 0 exch put
  175.   demof setfont
  176.   char stringwidth pop 2 div neg 0 rm
  177.   char show
  178.   gr
  179. } bd
  180.  
  181. % draw baseline
  182. /basel {
  183.   gs .1 setlinewidth -12 0 rm 24 0 rl st gr
  184. } bd
  185.  
  186. % accented char
  187. /accent {
  188.   gs
  189.   rasterscale div 8 div /dy exch def rasterscale div 8 div /dx exch def
  190.   exch char exch 0 exch put
  191.   demof setfont
  192.   char stringwidth pop 2 div neg 0 rm
  193.   gs char show gr
  194.   char exch 0 exch put
  195.   dx dy rm char show
  196.   gr
  197. } bd
  198.  
  199. % A few drawn characters
  200. /up     {chst -7 0 mt 7 0 ln 0 14 ln fl gr} bd
  201. /down   {chst -7 14 mt 0 0 ln 7 14 ln fl gr} bd
  202. /left   {chst -6 6 mt 7 0 ln 7 12 ln fl gr} bd
  203. /right  {chst -7 0 mt 6 6 ln -7 12 ln fl gr} bd
  204. /bx     {-8 -4 mt 8 -4 ln 8 16 ln -8 16 ln closepath fill} bd
  205. /fill25 {chst .95 setgray bx gr} bd
  206. /fill50 {chst .8 setgray bx gr} bd
  207. /fill75 {chst .6 setgray bx gr} bd
  208. /block  {chst 0 setgray bx gr} bd
  209. /dbcs   {chst .6 setlinewidth -10 16 mt 10 -4 ln -10 -4 mt 10 16 ln st gr} bd
  210.  
  211. %  image character
  212. %  <incr> <x-move> <y-move>  <widebytes> <high> ic
  213. /geti {currentfile exch readhexstring pop} bd
  214. /ic {
  215.   /Cy exch def /Cx exch def /Cb exch def /Cl exch def /Ci exch def
  216.   /Cz Cx 8 mul def
  217.   Cx Cy mul string /Im exch def Im geti pop
  218.   gs Cl rasterscale div Ci rasterscale 2 mul div sub Cb rasterscale div
  219.   rm currentpoint translate
  220.   Cz rasterscale div Cy rasterscale div scale
  221.   Cz Cy true [Cz 0 0 Cy neg 0 Cy] {Im} imagemask gr
  222. } bd
  223. end
  224. %%EndProcSet
  225.