home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / oberon / data / oberon.header.ps < prev    next >
Text File  |  1977-12-31  |  9KB  |  339 lines

  1. % $VER: Oberon.Headers.ps 1.0 (22.1.96)
  2. % m  moveto  x y -> -
  3. % s  String  s -> -
  4. % l  Line  x y w h -> -
  5. % x  XLine  x y dx dy -> -
  6. % c  scaled Circle  x y a b -> -
  7. % b  shaded box  x y w h col -> -
  8. % i  pattern image  x y w h mode  -> -
  9. % p  Page  n -> -
  10. % f  font mapping  fnt -> -
  11. % z Bezier cubic section  x1 y1 x2 y2 x3 y3 x0 y0 -> -
  12. % u UseColor  r g b -> -
  13.  
  14. %%% Parameters
  15. /printerOrigin (Pluto) def  % one of Unix, Pluto, V3
  16. /paperSize (A4) def         % one of A4, A3, Letter
  17. /orientation (Portrait) def % one of Portrait, Landscape
  18. /useSyntax (No) def        % "Yes": do not substitute Syntax by Helvetica
  19. %%% EndParameters
  20.  
  21. /bdef {bind def} bind def
  22. /m {moveto} bdef
  23. /s {show} bdef
  24. /u {setrgbcolor} bdef
  25.  
  26. /l {
  27.   /ph exch def
  28.   /pw exch def
  29.   newpath
  30.   moveto
  31.   pw 0 rlineto
  32.   0 ph rlineto
  33.   pw neg 0 rlineto
  34.   closepath
  35.   fill
  36. } bdef
  37.  
  38. /x {
  39.   /dy exch def
  40.   /dx exch def
  41.   newpath
  42.   moveto
  43.   dx dy rlineto
  44.   0 setlinewidth        % was 0 (JS)
  45.   stroke
  46. } bdef
  47.  
  48. /c {
  49.   /pb exch def
  50.   /pa exch def
  51.   newpath
  52.   gsave
  53.   translate
  54.   1 pb pa div scale
  55.   0 0 pa 0 360 arc
  56.   0 setlinewidth % was 0 (JS)
  57.   stroke
  58.   grestore
  59. } bdef
  60.  
  61. /shade {
  62.   gsave
  63.   col 0 eq {1 setgray} if
  64.   col 1 eq {0.99 setgray} if
  65.   col 2 eq {0.9 setgray} if
  66.   col 3 eq {0.65 setgray} if
  67.   col 4 eq {0.35 setgray} if
  68.   col 5 eq {0 setgray} if
  69.   fill
  70.   grestore
  71. } bdef
  72.  
  73. /max {
  74.   /h1 exch def
  75.   /h2 exch def
  76.   h1 h2 lt {h2} {h1} ifelse
  77. } bdef
  78.  
  79. /texture {
  80.   gsave
  81.   clip
  82.   newpath
  83.   col 6 eq
  84.     { px 20 idiv 20 mul py ph add 20 idiv 20 mul moveto
  85.       /maxwh pw ph max 20 add def
  86.       maxwh 10 idiv 1 add
  87.         { maxwh maxwh rlineto
  88.           maxwh neg dup 20 sub rmoveto
  89.         } repeat
  90.     } if
  91.   col 7 eq
  92.     { px 20 idiv 20 mul py 20 idiv 20 mul moveto
  93.       /maxwh pw ph max 20 add def
  94.       maxwh 10 idiv 1 add
  95.         { maxwh neg maxwh rlineto
  96.           maxwh 20 add maxwh neg rmoveto
  97.         } repeat
  98.     } if
  99.   col 8 eq
  100.     { px 15 idiv 15 mul py 15 idiv 15 mul moveto
  101.       /ph ph 25 add def
  102.       pw 15 idiv 1 add
  103.         { 0 ph rlineto
  104.           15 ph neg rmoveto
  105.         } repeat
  106.    } if
  107.   col 9 eq
  108.     { px 15 idiv 15 mul py 15 idiv 15 mul moveto
  109.       /pw pw 15 add def
  110.       ph 15 idiv 1 add
  111.        { pw 0 rlineto
  112.           pw neg 15 rmoveto
  113.         } repeat
  114.    } if
  115.   1 setlinewidth
  116.   stroke
  117.   grestore
  118. } bdef
  119.  
  120. /b {
  121.   /col exch def
  122.   /ph exch def
  123.   /pw exch def
  124.   /py exch def
  125.   /px exch def
  126.   newpath
  127.   px py moveto
  128.   pw 0 rlineto
  129.   0 ph rlineto
  130.   pw neg 0 rlineto
  131.   closepath
  132.   col 6 lt {shade} {texture} ifelse
  133. } bdef
  134.  
  135. /i { % pattern image follows procedure i immediately
  136.   /mode exch def
  137.   /ph exch def
  138.   /pw exch def
  139.   /py exch def
  140.   /px exch def
  141.   /picstr 256 string def
  142.   /nofbytes pw 7 add 8 idiv ph mul def
  143.   gsave
  144.   px py translate
  145.   pw mode 1 add mul ph mode 1 add mul scale
  146.   pw ph 1 [pw 0 0 ph 0 0]
  147.     {nofbytes 256 ge
  148.       { currentfile picstr readhexstring pop
  149.         /nofbytes nofbytes 256 sub def }
  150.       { /picstr nofbytes string def
  151.         currentfile picstr readhexstring pop
  152.         /nofbytes 0 def
  153.       } ifelse
  154.     } image
  155.   grestore
  156. } bdef
  157.  
  158. /f {findfont setfont} bdef
  159. %/f {cvn currentdict exch get setfont} bdef
  160. /MF {mul exch findfont exch scalefont setfont} bdef % MakeFont
  161. %/MF {mul 100 idiv exch findfont exch scalefont setfont} bdef % MakeFont (whole number scaling)
  162.  
  163. /z {newpath moveto curveto 0 setlinewidth stroke } bdef    % Bezier cubic section. width was 0 (JS)
  164.  
  165. /p {/#copies exch def showpage restore save} bdef    % show page for Booklet
  166. % /p {/#copies exch def} bdef    % show page for Booklet
  167.  
  168. /pl {gsave 2480 0 translate 90 rotate .7 .7 scale} bdef
  169. /pr {2506 0 translate} bdef
  170. /pp {grestore showpage restore save} bdef
  171.  
  172. /GlobalBuildGlyph {
  173.   1 index /CharData get exch
  174.   2 copy known not {pop /.notdef} if get
  175.   dup 0 get 0
  176.   2 index 1 4 getinterval aload pop
  177.   setcachedevice
  178.   dup 5 2 getinterval aload pop true
  179.   5 4 roll /imageMaskMatrix get
  180.   dup 4 6 index 7 get put
  181.   dup 5 6 index 8 get put
  182.   5 4 roll 9 1 getinterval cvx
  183.   imagemask
  184. } def
  185.  
  186. /GlobalBuildChar {
  187.   1 index /Encoding get exch get
  188.   1 index /BuildGlyph get exec
  189. } def
  190.  
  191. /FullOberonEncoding [
  192.   /ascii000/ascii001/ascii002/ascii003/ascii004/ascii005/ascii006/ascii007
  193.   /ascii008/ascii009/ascii010/ascii011/ascii012/ascii013/ascii014/ascii015
  194.   /ascii016/ascii017/ascii018/ascii019/ascii020/ascii021/ascii022/ascii023
  195.   /ascii024/ascii025/ascii026/ascii027/ascii028/ascii029/ascii030/ascii031
  196.   /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle
  197.   /parenleft/parenright/asterisk/plus/comma/minus/period/slash
  198.   /zero/one/two/three/four/five/six/seven
  199.   /eight/nine/colon/semicolon/less/equal/greater/question
  200.   /at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z
  201.   /bracketleft/backslash/bracketright/arrowup/underscore/grave
  202.   /a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
  203.   /braceleft/bar/braceright/tilde/ascii127
  204.   /Adieresis/Odieresis/Udieresis/adieresis/odieresis/udieresis/acircumflex/ecircumflex
  205.   /icircumflex/oicircumflex/uicircumflex/agrave/egrave/igrave/ograve/ugrave
  206.   /eacute/edieresis/idieresis/ccedilla/aacute/ntilde
  207.   /ascii150/ascii151/ascii152/ascii153/ascii154
  208.   /endash %/ascii155
  209.   /ascii156/ascii157/ascii158/hyphen
  210.   /ascii160/ascii161/ascii162/ascii163/ascii164/ascii165/ascii166/ascii167
  211.   /ascii168/ascii169/ascii170/germandbls/ascii172/ascii173/ascii174/ascii175
  212.   /ascii176/ascii177/ascii178/ascii179/ascii180/ascii181/ascii182/ascii183
  213.   /ascii184/ascii185/ascii186/ascii187/ascii188/ascii189/ascii190/ascii191
  214.   /ascii192/ascii193/ascii194/ascii195/ascii196/ascii197/ascii198/ascii199
  215.   /ascii200/ascii201/ascii202/ascii203/ascii204/ascii205/ascii206/ascii207
  216.   /ascii208/ascii209/ascii210/ascii211/ascii212/ascii213/ascii214/ascii215
  217.   /ascii216/ascii217/ascii218/ascii219/ascii220/ascii221/ascii222/ascii223
  218.   /ascii224/ascii225/ascii226/ascii227/ascii228/ascii229/ascii230/ascii231
  219.   /ascii232/ascii233/ascii234/ascii235/ascii236/ascii237/ascii238/ascii239
  220.   /ascii240/ascii241/ascii242/ascii243/ascii244/ascii245/ascii246/ascii247
  221.   /ascii248/ascii249/ascii250/ascii251/ascii252/ascii253/ascii254/ascii255
  222. ] def
  223.  
  224. /OberonEncoding [
  225.   128 /Adieresis
  226.   129 /Odieresis
  227.   130 /Udieresis
  228.   131 /adieresis
  229.   132 /odieresis
  230.   133 /udieresis
  231.   134 /acircumflex
  232.   135 /ecircumflex
  233.   136 /icircumflex
  234.   137 /ocircumflex
  235.   138 /ucircumflex
  236.   139 /agrave
  237.   140 /egrave
  238.   141 /igrave
  239.   142 /ograve
  240.   143 /ugrave
  241.   144 /eacute
  242.   145 /edieresis
  243.   146 /idieresis
  244.   147 /ccedilla
  245.   148 /aacute
  246.   149 /ntilde
  247.   155 /endash
  248.   159 /hyphen
  249.   171 /germandbls
  250. ] def
  251.  
  252. % font reencoding taken from P. Vollenweider, PostScript, Hanser Verlag 1988
  253. % encoding vector is /OberonEncoding
  254. % newfontdict basefontdict recode -
  255.  
  256. /recode
  257.   { findfont /basefontdict exch def
  258.     /OberonFont basefontdict maxlength dict def
  259.     basefontdict
  260.       { exch dup /FID ne
  261.         { dup /Encoding eq
  262.           { exch dup length array copy OberonFont 3 1 roll put }
  263.           { exch OberonFont 3 1 roll put }
  264.           ifelse
  265.         }
  266.         { pop pop }
  267.         ifelse
  268.       } forall
  269.     OberonEncoding aload pop
  270.     OberonEncoding length 2 idiv {OberonFont /Encoding get 3 1 roll put} repeat
  271.     dup OberonFont exch /FontName exch put
  272.     OberonFont definefont pop
  273.   } bdef
  274.  
  275.  
  276. /OberonInit {
  277. % systemdict /gcheck known {
  278. %       mark
  279. %       /HWResolution [300 300]
  280. %       counttomark 2 idiv dup dict begin
  281. %       {def} repeat
  282. %       pop currentdict
  283. %       end
  284. %     setpagedevice
  285. %  } if
  286.   paperSize (A4) eq {.24 .24 scale} if
  287.   paperSize (A3) eq {.34 .34 scale} if
  288.   paperSize (Letter) eq {.24 .22 scale} if
  289.   orientation (Portrait) eq
  290.   { printerOrigin (Pluto) eq {152 18 translate} if
  291.     printerOrigin (Unix)  eq {60 10 translate} if
  292.     printerOrigin (V3)    eq {0 0 translate} if   %Oberon4Amiga 1.0 used: 10 0
  293.   }
  294.   { 2480.3 0 translate 90 rotate
  295.     printerOrigin (Pluto) eq {12 106 translate} if
  296.     printerOrigin (Unix)  eq {7 42 translate} if
  297.     printerOrigin (V3)    eq {0 0 translate} if
  298.   } ifelse
  299.   0 setgray
  300. } bdef
  301.  
  302. /OberonClose {
  303. } bdef
  304.  
  305. % Font mapping
  306.  
  307. /Helvetica-ScaleFactor 3.66 def
  308. /Helvetica.Roman.Fnt   /Helvetica def
  309. /Helvetica.Bold.Fnt    /Helvetica-Bold def
  310. /Helvetica.Italic.Fnt  /Helvetica-Oblique def
  311. /Helvetica.Magic.Fnt   /Helvetica def
  312.  
  313. useSyntax (Yes) eq
  314. { /Syntax-ScaleFactor  3.66 def   % a better value anyone?
  315.   /Syntax.Roman.Fnt    /Syntax-Roman def
  316.   /Syntax.Bold.Fnt     /Syntax-Bold def
  317.   /Syntax.Italic.Fnt   /Syntax-Italic def
  318.   /Syntax.Magic.Fnt    /Syntax-Roman def
  319. }
  320. { /Syntax-ScaleFactor  Helvetica-ScaleFactor def
  321.   /Syntax.Roman.Fnt    Helvetica.Roman.Fnt def
  322.   /Syntax.Bold.Fnt     Helvetica.Bold.Fnt def
  323.   /Syntax.Italic.Fnt   Helvetica.Italic.Fnt def
  324.   /Syntax.Magic.Fnt    Helvetica.Magic.Fnt def
  325. } ifelse
  326.  
  327. /Times-ScaleFactor     4 def
  328. /Times.Roman.Fnt       /Times-Roman def
  329. /Times.Italic.Fnt      /Times-Italic def
  330. /Times.Bold.Fnt        /Times-Bold def
  331. /Times.Magic.Fnt       /Times-Roman def
  332.  
  333. /Courier-ScaleFactor   4 def
  334. /Courier.Roman.Fnt     /Courier def
  335. /Courier.Italic.Fnt    /Courier-Italic def
  336. /Courier.Bold.Fnt      /Courier-Bold def
  337. /Courier.Magic.Fnt     /Courier def
  338.  
  339.