home *** CD-ROM | disk | FTP | other *** search
/ Frame 3.2 / Frame.iso / Application / FrameMaker.app / fminit2.0 / next / makerprint.ps < prev    next >
Encoding:
Text File  |  1994-08-11  |  18.4 KB  |  822 lines

  1. %-
  2. %- FrameMaker Postscript Prolog 3.0, for use with FrameMaker 3.0
  3. %- Copyright (c) 1986, 87, 88, 89, 90, 91, 94 by Frame Technology, Inc.
  4. %- All rights reserved.
  5. %-
  6. %-
  7.  
  8. /landscape false def
  9.  
  10. % 29July1994 wiml@omnigroup.com  bug #84386
  11. % The fix for this bug is to use the PSL2 pattern operators. If 
  12. % we don't have PSL2, we just use the old buggy "setscreen" code. (oh well.)
  13. % Here we determine if we have PSL2.
  14. /FmHavePSL2
  15.   systemdict /languagelevel known {languagelevel 2 ge} {false} ifelse
  16. pop false % Force use of setscreen hack --- pattern ops are not working
  17.     % well enough this release. 
  18. def
  19.  
  20.  
  21.  
  22. /orgmatrix matrix def
  23. /savematrix {
  24.     orgmatrix currentmatrix pop
  25. } bind def
  26. /restorematrix {
  27.     orgmatrix setmatrix
  28. } bind def
  29.  
  30. /dmatrix matrix def
  31. /desiredpat 0 def
  32. /dpi    72 0 dmatrix defaultmatrix dtransform
  33.     dup mul exch   dup mul add   sqrt round
  34. def
  35. /freq dpi 18.75 div 8 div round dup 0 eq { pop 1 } if 8 mul dpi exch div def
  36. /sangle 1 0 dmatrix defaultmatrix dtransform exch atan def
  37. /graymode true def
  38. /pats 16 array def
  39. /mymatrix matrix def
  40. /savedgray 0 def
  41. /F /fill load def
  42. /rc /rectclip load def
  43. /GS /gsave load def
  44. /GR /grestore load def
  45. /SL /setlinewidth load def
  46. /SC /setlinecap load def
  47. /CS { closepath S } bind def
  48. /A /strokepath load def
  49. /TR /translate load def
  50. /L /lineto load def
  51. /M /moveto load def
  52. /D /curveto load def
  53. /C /closepath load def
  54. /T { moveto show } bind def
  55. /smat { mymatrix currentmatrix pop } bind def
  56. /rmat { mymatrix setmatrix } bind def
  57. /sp { /desiredpat exch store } bind def % 29July94 wiml@omni #84386
  58.  
  59.  
  60. systemdict /xshow known not {
  61.     /xhow {
  62.         /pts exch def
  63.         /str exch def
  64.         0 1 str length 1 sub {
  65.             currentpoint 3 -1 roll str 1 index 1 getinterval show
  66.             3 1 roll moveto
  67.             pts exch get 0 rmoveto
  68.         } for
  69.     } bind def
  70. } {
  71.     /xhow {
  72.         checkink xshow
  73.     } bind def
  74. } ifelse
  75.  
  76. systemdict /xyshow known not {
  77.     /xyhow {
  78.         /pts exch def
  79.         /str exch def
  80.         0 1 str length 1 sub {
  81.             currentpoint 3 -1 roll str 1 index 1 getinterval show
  82.             3 1 roll moveto 2 mul
  83.             pts 1 index get pts 3 -1 roll 1 add get rmoveto
  84.         } for
  85.     } bind def
  86. } {
  87.     /xyhow {
  88.         checkink xyshow
  89.     } bind def
  90. } ifelse
  91.  
  92. % close clipping down to this rectangle
  93. % must be outside FrameDict
  94. /CR { % x y w h
  95.     %    4 copy errfile 5 1 roll (% % % % CR\n) fprintf
  96.     %    initclip
  97.     %    rectclip
  98.     initclip
  99.     newpath
  100.     4 2 roll M dup 0 exch rlineto exch 0 rlineto 0 exch neg rlineto
  101.     C clip newpath
  102. } bind def
  103.  
  104. %
  105. % XXX HACK -- These must live outside FrameDict, which is only active
  106. % when we are printing a page.
  107. %
  108.  
  109. % 7August1994 wiml@omnigroup.com #84261/#84386
  110. % Utility routines. makecontextpattern takes bitmap data and returns a 
  111. % newly created pattern object which is stored in the 'pats' array.
  112. % fmpatternpainter and fmpatternbbox are defined ahead of time to reduce
  113. % silliness and VM usage.
  114. /fmpatternpainter
  115. {
  116.   begin
  117.     8 8 //true null patternImageData imagemask
  118.   end
  119. } dup 4 [1 0 0 1 0 0] put bind def
  120.  
  121. /fmpatternbbox [0 0 8 8] def
  122.  
  123. % 29July1994 wiml@omni #84386
  124. /makecontextpattern  % data name index
  125.  
  126. { % implementation for non-Level2 printers
  127.     exch pop
  128.     [null 8 1 /setpattern cvx] 4 array copy  dup % name data index array array
  129.     0 5 -1 roll put cvx                         % name index array
  130.     pats 3 1 roll put
  131. }
  132.  
  133. { % implementation for Level2 printers. 8Aug94 wiml@omni #84386
  134.   % We simply create a pattern object with 'makepattern' and store
  135.   % it in the 'pats' array.
  136.     pats exch 4 2 roll pop 
  137.     % array index data
  138.     <<
  139.       /patternImageData 3 -1 roll
  140.       /PaintType 2
  141.       /TilingType 3
  142.       /PatternType 1
  143.       /BBox //fmpatternbbox
  144.       /XStep 8
  145.       /YStep 8
  146.       /PaintProc //fmpatternpainter
  147.     >> 
  148.     0.5 dup matrix scale makepattern
  149.     % array index pattern-object
  150.     put
  151. }
  152. FmHavePSL2 { exch } if pop bind def
  153.  
  154. %
  155. %
  156. %
  157.  
  158. /patoffsetx 0 def
  159. /patoffsety 0 def
  160. /currentpat null def
  161.  
  162. /FrameDict 250 dict def    % declare FrameDict
  163.  
  164. %
  165. % Called at beginning of page.
  166. % Push FrameDict onto dictionary stack.
  167. %
  168. /FMBEGINPAGE {
  169.     FrameDict begin
  170. } def    % used infrequently, so no bind
  171. /FMENDPAGE {
  172.     end    % FrameDict -- should I assert this?
  173. } def    % used infrequently, so no bind
  174.  
  175. /FMLOCAL {
  176.     FrameDict begin
  177.     0 def % force a definition to make sure room in FrameDict for later
  178.     end % FrameDict
  179. } def % only used at startup, so no bind
  180.  
  181. % Put most defs into FrameDict.
  182. FrameDict begin
  183.  
  184. % Hack.  NXImage code generates underflows on some rotations.
  185. /NaN 0 def
  186.  
  187. /gstring 0 def
  188. /gfile 0 def
  189. /gindex 0 def
  190.  
  191. /orgxfer 0 def
  192. /yscale 0 def
  193. /xscale 0 def
  194.  
  195. %
  196. % Color Handling
  197. %
  198. %/FMPrintInColor true def
  199. /FMPrintInColor
  200.     systemdict /colorimage known
  201.     systemdict /currentcolortransfer known or
  202.     % FMwantcolorprinting is written into the PostScript stream by FrameMaker.
  203.     FMwantcolorprinting and
  204. def
  205.  
  206. FMPrintInColor {
  207.     /HUE 0 def
  208.     /SAT 0 def
  209.     /BRIGHT 0 def
  210.     % array of arrays Hue and Sat values for the separations [HUE BRIGHT]
  211.     /Colors [
  212.         [0    0  ]    % black
  213.         [0    0  ]    % white
  214.         [0.00 1.0]    % red
  215.         [0.37 1.0]    % green
  216.         [0.60 1.0]    % blue
  217.         [0.50 1.0]    % cyan
  218.         [0.83 1.0]    % magenta
  219.         [0.16 1.0]    % comment
  220.     ] def
  221.  
  222.     /K {
  223.         Colors exch get dup
  224.         0 get /HUE exch store
  225.         1 get /BRIGHT exch store
  226.         HUE 0 eq BRIGHT 0 eq and {
  227.             1.0 SAT sub setgray
  228.         } {
  229.             HUE SAT BRIGHT sethsbcolor
  230.         } ifelse
  231.     } def
  232.     /KT /K load def
  233.     /mysetgray {
  234.         /SAT exch 1.0 exch sub store
  235.         HUE 0 eq BRIGHT 0 eq and {
  236.             1.0 SAT sub setgray
  237.         } {
  238.             HUE SAT BRIGHT sethsbcolor
  239.         } ifelse
  240.     } bind def
  241. } {
  242.     /mysetgray /setgray load def
  243.     /K /pop load def
  244.     /KT /pop load def
  245. } ifelse
  246.  
  247. %
  248. % pattern filling has to use setgray, so we keep track of what the
  249. % gray value should really be.
  250. %
  251. /G { /savedgray exch def savedgray mysetgray } def
  252.  
  253. % 29July1994 wiml@omni #84386
  254. % Only define setpattern if we're using the setscreen hack.
  255. FmHavePSL2 not
  256. {
  257.     /setpattern { % <0F1E3C78F0E1C387> 8 1
  258.     %     orgfreq organgle orgproc cvx setscreen
  259.     /bwidth  exch def
  260.     /bpside  exch def
  261.     /bstring exch def
  262.     /onbits 0 def
  263.     /offbits 0 def
  264.     freq sangle landscape {90 add} if
  265.     {
  266.         /y exch def
  267.         /x exch def
  268.         /xindex x 1 add 2 div bpside mul cvi def
  269.         /yindex y 1 add 2 div bpside mul cvi def
  270.         bstring yindex bwidth mul xindex 8 idiv add get
  271.         1 7 xindex 8 mod sub bitshift and 0 ne
  272.         {/onbits  onbits  1 add def 1}
  273.         {/offbits offbits 1 add def 0}
  274.         ifelse
  275.     } setscreen
  276.        % 29Jul94 wiml@omni #84386 Taking a hint from the Sun port,
  277.        % we blow away the transfer function instead of trying to 
  278.        % use a precalculated inverse.
  279.        { } settransfer
  280.        offbits dup onbits add div mysetgray
  281. %      tran offbits 64 mul offbits onbits add div cvi get mysetgray
  282.     } bind def
  283. }
  284. if
  285.  
  286. /myfonts [] def
  287. /procarray 30 array def
  288. 3.86 setmiterlimit
  289.  
  290. /currentpat -1 def
  291. /orgxfer currenttransfer cvlit def
  292. FmHavePSL2
  293. {
  294.   currenthalftonephase
  295.     /orgphasey exch def
  296.     /orgphasex exch def
  297. } {
  298.   currentscreen cvlit
  299.     /orgproc exch def
  300.     /organgle exch def
  301.     /orgfreq exch def
  302. } ifelse
  303.  
  304.  
  305.  
  306. %
  307. % make sure we are setup for the current desired pattern fill
  308. %
  309. /checkpat {
  310.     graymode currentpat desiredpat ne or {
  311.         patoffsetx patoffsety sethalftonephase
  312.         0 mysetgray
  313.         currentcolor pats desiredpat get setpattern
  314.         /graymode false store
  315.         /currentpat desiredpat store
  316.     } if
  317. } {
  318.     graymode currentpat desiredpat ne or {
  319.         pats desiredpat get exec
  320.         /graymode false store
  321.         /currentpat desiredpat store
  322.     } if
  323. } FmHavePSL2 not { exch } if pop bind def
  324.  
  325. FmHavePSL2
  326. {
  327. /patfill 
  328. {
  329.   gsave
  330.     1 setgray fill
  331.   grestore
  332.   fill
  333. } bind def
  334.  
  335. /rectpatfill 
  336. {
  337.   gsave
  338.     1 setgray 4 copy rectfill
  339.   grestore
  340.   rectfill
  341. } bind def
  342.  
  343. /rectpatstroke 
  344. {
  345.   gsave
  346.     1 setgray 4 copy rectstroke
  347.   grestore
  348.   rectstroke
  349. } bind def
  350. }
  351. {
  352.   /patfill /fill load def
  353.   /rectpatfill /rectfill load def
  354.   /rectpatstroke /rectstroke load def
  355. } ifelse
  356.  
  357. %/checkpat {
  358. %    graymode currentpat desiredpat ne or {
  359. %        pats desiredpat get exec
  360. %        /graymode false store
  361. %        /currentpat desiredpat store
  362. %    } if
  363. %} bind def
  364.  
  365.  
  366. /Z { checkpat patfill } bind def
  367.  
  368. %
  369. % make sure we are setup to gray ink
  370. %
  371. /checkink {
  372.     graymode not {
  373.         FmHavePSL2
  374.         { orgphasex orgphasey sethalftonephase } 
  375.         { orgfreq organgle orgproc cvx setscreen 
  376.           orgxfer cvx settransfer              } ifelse
  377.         /graymode true store
  378.         savedgray mysetgray
  379.     } if
  380. } bind def
  381.  
  382.  
  383. /F {
  384.     checkink fill
  385. } bind def
  386.  
  387. /dorectfill {
  388.     checkink rectfill
  389. } bind def
  390.  
  391. /dorectstroke {
  392.     checkink rectstroke
  393. } bind def
  394.  
  395. /S {
  396.     checkink stroke
  397. } bind def
  398.  
  399.  
  400. /FmEncoding [
  401. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  402. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  403. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  404. /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  405. /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl
  406. /numbersign /dollar /percent /ampersand /quotesingle /parenleft
  407. /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one
  408. /two /three /four /five /six /seven /eight /nine /colon /semicolon
  409. /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K
  410. /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash
  411. /bracketright /asciicircum /underscore /grave /a /b /c /d /e /f /g /h
  412. /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar
  413. /braceright /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute
  414. /Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis
  415. /atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis
  416. /iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve
  417. /ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex
  418. /udieresis /dagger /.notdef /cent /sterling /section /bullet
  419. /paragraph /germandbls /registered /copyright /trademark /acute
  420. /dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef
  421. /yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  422. /ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown
  423. /exclamdown /logicalnot /.notdef /florin /.notdef /.notdef
  424. /guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde
  425. /Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright
  426. /quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis
  427. /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl
  428. /periodcentered /quotesinglbase /quotedblbase /perthousand
  429. /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute
  430. /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve
  431. /Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron
  432. /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
  433. ] def
  434.  
  435. /FmEncode {    % basefontdict => newfontdict
  436.     /basefontdict exch def
  437.     /newfontdict basefontdict maxlength 3 add dict def
  438.     basefontdict {
  439.         exch dup /FID ne {
  440.             dup /Encoding eq {
  441.                 exch pop FmEncoding
  442.             } {
  443.                 exch
  444.             } ifelse
  445.             newfontdict 3 1 roll put
  446.         } {
  447.             pop pop
  448.         } ifelse
  449.     } forall
  450.     newfontdict
  451. } def
  452.  
  453. /rrectpath { %    r x y w h  =>  -  (make a round rect path)
  454.     smat
  455.     4 2 roll TR            % r w h
  456.     /h exch def /w exch def /r exch def
  457.     mark
  458.         r 0 M
  459.         w 0 w h r arcto w h 0 h r arcto
  460.         0 h 0 0 r arcto 0 0 w 0 r arcto C
  461.     cleartomark
  462.     rmat
  463. } def
  464.  
  465. /RF { % r x y w h
  466.     rrectpath F
  467. } bind def
  468.  
  469. /RP { % r x y w h
  470.     checkpat rrectpath patfill
  471. } bind def
  472.  
  473. /RS { % r x y w h
  474.     rrectpath S
  475. } bind def
  476.  
  477. /RQ { % r x y w h
  478.     checkpat rrectpath A patfill
  479. } bind def
  480.  
  481. /NF { % x y w h
  482.     dorectfill
  483. } bind def
  484.  
  485. /NR { % w h x y
  486.     checkpat
  487.     4 2 roll
  488.     rectpatfill
  489. } bind def
  490.  
  491. /W { % x y w h
  492.     savedgray 5 1 roll 1.0 G  dorectfill G } bind def
  493.  
  494. /PP { % int n
  495.     newpath
  496.     3 1 roll M 1 sub
  497.     { lineto } repeat
  498.     } bind def
  499.  
  500. /SP { % int n
  501.     3 1 roll M 3 div cvi
  502.     { curveto } repeat
  503. } bind def
  504.  
  505. /rectpath  { % w h x y
  506.     M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
  507. } def
  508.  
  509. /N { %  x y w h
  510.     dorectstroke
  511. } bind def
  512.  
  513. /NQ { % int w, int h, int x, int y
  514.     checkpat
  515.     4 2 roll
  516.     rectpatstroke
  517. } bind def
  518.  
  519. % fill a box with a pattern
  520. /replbox { % string datastring, string proc, int w, int h, int x, int y
  521.     M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
  522.     currentgray .5 setgray fill setgray pop pop
  523. } def
  524.  
  525. /graybox { % x y w h => -
  526.     currentgray 5 1 roll
  527.     .6666666 setgray rectfill setgray
  528. } bind def
  529.  
  530. /darkgraybox { % x y w h => -
  531.     currentgray 5 1 roll
  532.     .333333 setgray rectfill setgray
  533. } bind def
  534.  
  535. /arcpath { % int th, int dth, int w, int h, int x, int y
  536.     newpath
  537.     TR
  538.     /h exch def
  539.     /w exch def
  540.     /dth exch def
  541.     /th exch def
  542.     90 th dth add sub 90 th sub       % theta1 theta2
  543.     dth 0 lt
  544.         { exch } if
  545.     1 h w div neg scale
  546.     0 0 w 2 div 5 -2 roll arc
  547. } def
  548.  
  549. /AS { % int th, int dth, int w, int h, int x, int y
  550.     smat
  551.     arcpath
  552.     rmat
  553.     S
  554. } bind def
  555.  
  556. /AP { % int th, int dth, int w, int h, int x, int y
  557.     checkpat
  558.     smat
  559.     arcpath
  560.     rmat
  561.     A patfill
  562. } bind def
  563.  
  564. /AF { % int th, int dth, int w, int h, int x, int y
  565.     smat
  566.     arcpath
  567.     0 0 lineto
  568.     rmat
  569.     F
  570. } bind def
  571.  
  572. /AQ { % int th, int dth, int w, int h, int x, int y
  573.     checkpat
  574.     smat
  575.     arcpath
  576.     0 0 lineto
  577.     rmat
  578.     patfill
  579. } bind def
  580.  
  581. /mymakefont { % i name size
  582.     /size exch def
  583.     /name exch def
  584.     /i exch def
  585.     /myfontdict name cvn findfont def
  586.     %
  587.     % FrameMaker provides its own encoding vector for fonts in which
  588.     % normal alphabetic characters are printed (it doesn't change the
  589.     % encoding vector for Symbol fonts).  The way we detect an
  590.     % alphabetic character font is by name: if the encoding vector
  591.     % is either StandardEncoding (Adobe's standard) or NextStepEncoding
  592.     % (the default on the NeXT system), then it's assume it's for
  593.     % alphabetic characters, and re-encode it.
  594.     %
  595.     % This first part is concerned with discovering the encoding vector's
  596.     % name and comparing it to StandardEncoding and NextStepEncoding.
  597.     % The process is complicated by the fact that not every printer
  598.     % understands NextStepEncoding.
  599.     % Leave on the stack 1 or 0, telling whether we need to re-encode.
  600.     %
  601.     % A better way to do this might be to have FrameMaker pass to
  602.     % mymakefont a flag indicating that "you need to re-encode."
  603.     %
  604.     myfontdict begin
  605.         Encoding StandardEncoding eq
  606.         /NextStepEncoding where { pop Encoding NextStepEncoding eq or } if
  607.     end % myfontdict
  608.     %
  609.     % Based on the 1 or 0 atop the stack, re-encode if necessary.
  610.     %
  611.     {
  612.         myfontdict FmEncode /gfontdict exch def
  613.         /gfontdict (F   ) dup 1 i (   ) cvs putinterval cvn
  614.                 gfontdict definefont def
  615.     } {
  616.         /gfontdict myfontdict def
  617.     } ifelse
  618.  
  619.     /myfonts [ myfonts aload pop null ] def
  620.     myfonts i  gfontdict  [size 0 0 size neg 0 0 ] makefont put
  621. } def
  622.  
  623. /mymakefontmetric { % i name size printermetrics
  624.     /BitmapWidths exch 0 eq def   % the font reencoding will add this to font
  625.     mymakefont
  626. } def
  627.  
  628. /FF { % i
  629.     myfonts exch get setfont
  630. } bind def
  631.  
  632. /cliptowindow {
  633.     initclip
  634. } def
  635.  
  636. /beginprintcode { % -x -y w h scale dx dy
  637.     GS
  638.     newpath 1 setlinewidth 0 SL 0 setlinejoin
  639.     [] 0 setdash 0 setgray 10 setmiterlimit
  640.     /FMdicttop countdictstack 1 add def % high-water mark of dict stack
  641.     /FMoptop count 7 sub def % tricky! 7 params on stack, plus "/FMoptop"
  642.     200 dict begin
  643.     /showpage {} def
  644.     TR                      % translate to bottom left
  645.     dup neg scale                % convert to postscript coordinates
  646.     0.0 0.0 M
  647. } def
  648.  
  649. /endprintcode {
  650.     count -1 FMoptop {pop pop} for % clear user junk from operand stack
  651.     countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
  652.     GR
  653. } def
  654.  
  655. /beginPSInsetprintcode {
  656.     /pinsetsave save def
  657.     newpath 1 setlinewidth 0 setlinecap 0 setlinejoin
  658.     [] 0 setdash 0 setgray 10 setmiterlimit
  659.     /FMdicttop countdictstack 1 add def % high-water mark of dict stack
  660.     /FMoptop count def % tricky!           +1 in both cases for the 'for' loop.
  661.     200 dict begin
  662.     /showpage {} def
  663.     /showimage {} def
  664. } def
  665.  
  666. /endPSInsetprintcode {
  667.     count -1 FMoptop {pop pop} for % clear user junk from operand stack
  668.     countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
  669.     pinsetsave restore
  670. } def
  671.  
  672. /cacheimage { % destX destY destWidth destHeight w h bps theta flip
  673.     /flip exch def
  674.     /theta exch def
  675.     /bps exch def
  676.     /h exch def
  677.     /w exch def
  678.     /destHeight exch def
  679.     /destWidth exch def
  680.     /destY exch def
  681.     /destX exch def
  682.     /rowbytes w bps mul 7 add 8 idiv def
  683.     /buffer rowbytes string def
  684.  
  685.     GS
  686.     destX destY TR
  687.     theta rotate
  688.     destWidth flip {neg} if destHeight scale
  689.     w h bps
  690.     % [w 0 0 h neg 0 h ]
  691.     [w 0 0 h 0 h ]
  692.     { currentfile buffer readhexstring pop } bind
  693.     image
  694.     GR
  695. } def
  696.  
  697. /inch{72 mul}def
  698. /paperheight 0 def /paperwidth 0 def
  699. /pagedimen {
  700.     paperheight sub abs 16 lt exch
  701.     paperwidth sub abs 16 lt and
  702.     {/papername exch def} {pop} ifelse
  703. } def
  704. /setpapername {
  705.     /papersizedict 14 dict def
  706.     papersizedict begin
  707.     /papername /unknown def
  708.     /Letter 8.5 inch 11.0 inch pagedimen
  709.     /LetterSmall 7.68 inch 10.16 inch pagedimen
  710.     /Tabloid 11.0 inch 17.0 inch pagedimen
  711.     /Ledger 17.0 inch 11.0 inch pagedimen
  712.     /Legal 8.5 inch 14.0 inch pagedimen
  713.     /Statement 5.5 inch 8.5 inch pagedimen
  714.     /Executive 7.5 inch 10.0 inch pagedimen
  715.     /A3 11.69 inch 16.5 inch pagedimen
  716.     /A4 8.26 inch 11.69 inch pagedimen
  717.     /A4Small 7.47 inch 10.85 inch pagedimen
  718.     /B4 10.125 inch 14.33 inch pagedimen
  719.     /B5 7.16 inch 10.125 inch pagedimen
  720.     end
  721. } def
  722. /papersize {
  723.     papersizedict begin
  724.     /Letter {lettertray letter} def
  725.     /LetterSmall {lettertray lettersmall} def
  726.     /Tabloid {11x17tray 11x17} def
  727.     /Ledger {ledgertray ledger} def
  728.     /Legal {legaltray legal} def
  729.     /Statement {statementtray statement} def
  730.     /Executive {executivetray executive} def
  731.     /A3 {a3tray a3} def
  732.     /A4 {a4tray a4} def
  733.     /A4Small {a4tray a4small} def
  734.     /B4 {b4tray b4} def
  735.     /B5 {b5tray b5} def
  736.     /unknown {unknown} def
  737.     papersizedict dup papername known {papername} {/unknown} ifelse get
  738.     end
  739.     /FMdicttop countdictstack 1 add def
  740.     statusdict begin stopped end
  741.     countdictstack -1 FMdicttop {pop end} for
  742. } def
  743. /manualpapersize {
  744.     papersizedict begin
  745.     /Letter {letter} def
  746.     /LetterSmall {lettersmall} def
  747.     /Tabloid {11x17} def
  748.     /Ledger {ledger} def
  749.     /Legal {legal} def
  750.     /Statement {statement} def
  751.     /Executive {executive} def
  752.     /A3 {a3} def
  753.     /A4 {a4} def
  754.     /A4Small {a4small} def
  755.     /B4 {b4} def
  756.     /B5 {b5} def
  757.     /unknown {unknown} def
  758.     papersizedict dup papername known {papername} {/unknown} ifelse get
  759.     end
  760.     stopped
  761. } def
  762. /desperatepapersize {
  763.     statusdict /setpageparams known {
  764.         paperwidth paperheight 0 1
  765.         statusdict begin
  766.         {setpageparams} stopped pop
  767.         end
  768.     } if
  769. } def
  770. /manualfeed false def
  771.  
  772. % sbs 910917
  773. /FmHorrible {
  774.     4 dict begin
  775.     /execuserobject {pop} def
  776.     /undefineuserobject {pop} def
  777.     /termwindow {} def
  778.     /currentgstate {null} def
  779. } def
  780. /FmEndHorrible {
  781.     end
  782. } def
  783.  
  784. end    % of FrameDict definitions
  785.  
  786. % This name needs to be outside FrameDict because it's called by
  787. % NeXT code outside any printable page.
  788. /FmConfigurePaper { % width height name manualfeed FmConfigurePaper -
  789.     FrameDict begin
  790.         pop % sacrifice manualfeed, for now.
  791.         pop    % sacrifice name, for now.
  792.         /paperheight exch def /paperwidth exch def
  793.         setpapername
  794.         manualfeed {true} {papersize} ifelse
  795.         {manualpapersize} {false} ifelse
  796.         {desperatepapersize} if
  797.     end
  798. } def
  799.  
  800.  
  801. %
  802. % OPI stuff
  803. %
  804. /ALDsave FMLOCAL
  805. /ALDmatrix matrix def ALDmatrix currentmatrix pop
  806.  
  807. /StartALD {
  808.     /ALDsave save def
  809.     savematrix
  810.     ALDmatrix setmatrix
  811. } bind def
  812.  
  813. /InALD {
  814.     restorematrix
  815. } bind def
  816.  
  817. /DoneALD {
  818.     ALDsave restore
  819. } bind def
  820.  
  821. % OPI end
  822.