home *** CD-ROM | disk | FTP | other *** search
- %-
- %- FrameMaker Postscript Prolog 3.0, for use with FrameMaker 3.0
- %- Copyright (c) 1986, 87, 88, 89, 90, 91, 94 by Frame Technology, Inc.
- %- All rights reserved.
- %-
- %-
-
- /landscape false def
-
- % 29July1994 wiml@omnigroup.com bug #84386
- % The fix for this bug is to use the PSL2 pattern operators. If
- % we don't have PSL2, we just use the old buggy "setscreen" code. (oh well.)
- % Here we determine if we have PSL2.
- /FmHavePSL2
- systemdict /languagelevel known {languagelevel 2 ge} {false} ifelse
- pop false % Force use of setscreen hack --- pattern ops are not working
- % well enough this release.
- def
-
-
-
- /orgmatrix matrix def
- /savematrix {
- orgmatrix currentmatrix pop
- } bind def
- /restorematrix {
- orgmatrix setmatrix
- } bind def
-
- /dmatrix matrix def
- /desiredpat 0 def
- /dpi 72 0 dmatrix defaultmatrix dtransform
- dup mul exch dup mul add sqrt round
- def
- /freq dpi 18.75 div 8 div round dup 0 eq { pop 1 } if 8 mul dpi exch div def
- /sangle 1 0 dmatrix defaultmatrix dtransform exch atan def
- /graymode true def
- /pats 16 array def
- /mymatrix matrix def
- /savedgray 0 def
- /F /fill load def
- /rc /rectclip load def
- /GS /gsave load def
- /GR /grestore load def
- /SL /setlinewidth load def
- /SC /setlinecap load def
- /CS { closepath S } bind def
- /A /strokepath load def
- /TR /translate load def
- /L /lineto load def
- /M /moveto load def
- /D /curveto load def
- /C /closepath load def
- /T { moveto show } bind def
- /smat { mymatrix currentmatrix pop } bind def
- /rmat { mymatrix setmatrix } bind def
- /sp { /desiredpat exch store } bind def % 29July94 wiml@omni #84386
-
-
- systemdict /xshow known not {
- /xhow {
- /pts exch def
- /str exch def
- 0 1 str length 1 sub {
- currentpoint 3 -1 roll str 1 index 1 getinterval show
- 3 1 roll moveto
- pts exch get 0 rmoveto
- } for
- } bind def
- } {
- /xhow {
- checkink xshow
- } bind def
- } ifelse
-
- systemdict /xyshow known not {
- /xyhow {
- /pts exch def
- /str exch def
- 0 1 str length 1 sub {
- currentpoint 3 -1 roll str 1 index 1 getinterval show
- 3 1 roll moveto 2 mul
- pts 1 index get pts 3 -1 roll 1 add get rmoveto
- } for
- } bind def
- } {
- /xyhow {
- checkink xyshow
- } bind def
- } ifelse
-
- % close clipping down to this rectangle
- % must be outside FrameDict
- /CR { % x y w h
- % 4 copy errfile 5 1 roll (% % % % CR\n) fprintf
- % initclip
- % rectclip
- initclip
- newpath
- 4 2 roll M dup 0 exch rlineto exch 0 rlineto 0 exch neg rlineto
- C clip newpath
- } bind def
-
- %
- % XXX HACK -- These must live outside FrameDict, which is only active
- % when we are printing a page.
- %
-
- % 7August1994 wiml@omnigroup.com #84261/#84386
- % Utility routines. makecontextpattern takes bitmap data and returns a
- % newly created pattern object which is stored in the 'pats' array.
- % fmpatternpainter and fmpatternbbox are defined ahead of time to reduce
- % silliness and VM usage.
- /fmpatternpainter
- {
- begin
- 8 8 //true null patternImageData imagemask
- end
- } dup 4 [1 0 0 1 0 0] put bind def
-
- /fmpatternbbox [0 0 8 8] def
-
- % 29July1994 wiml@omni #84386
- /makecontextpattern % data name index
-
- { % implementation for non-Level2 printers
- exch pop
- [null 8 1 /setpattern cvx] 4 array copy dup % name data index array array
- 0 5 -1 roll put cvx % name index array
- pats 3 1 roll put
- }
-
- { % implementation for Level2 printers. 8Aug94 wiml@omni #84386
- % We simply create a pattern object with 'makepattern' and store
- % it in the 'pats' array.
- pats exch 4 2 roll pop
- % array index data
- <<
- /patternImageData 3 -1 roll
- /PaintType 2
- /TilingType 3
- /PatternType 1
- /BBox //fmpatternbbox
- /XStep 8
- /YStep 8
- /PaintProc //fmpatternpainter
- >>
- 0.5 dup matrix scale makepattern
- % array index pattern-object
- put
- }
- FmHavePSL2 { exch } if pop bind def
-
- %
- %
- %
-
- /patoffsetx 0 def
- /patoffsety 0 def
- /currentpat null def
-
- /FrameDict 250 dict def % declare FrameDict
-
- %
- % Called at beginning of page.
- % Push FrameDict onto dictionary stack.
- %
- /FMBEGINPAGE {
- FrameDict begin
- } def % used infrequently, so no bind
- /FMENDPAGE {
- end % FrameDict -- should I assert this?
- } def % used infrequently, so no bind
-
- /FMLOCAL {
- FrameDict begin
- 0 def % force a definition to make sure room in FrameDict for later
- end % FrameDict
- } def % only used at startup, so no bind
-
- % Put most defs into FrameDict.
- FrameDict begin
-
- % Hack. NXImage code generates underflows on some rotations.
- /NaN 0 def
-
- /gstring 0 def
- /gfile 0 def
- /gindex 0 def
-
- /orgxfer 0 def
- /yscale 0 def
- /xscale 0 def
-
- %
- % Color Handling
- %
- %/FMPrintInColor true def
- /FMPrintInColor
- systemdict /colorimage known
- systemdict /currentcolortransfer known or
- % FMwantcolorprinting is written into the PostScript stream by FrameMaker.
- FMwantcolorprinting and
- def
-
- FMPrintInColor {
- /HUE 0 def
- /SAT 0 def
- /BRIGHT 0 def
- % array of arrays Hue and Sat values for the separations [HUE BRIGHT]
- /Colors [
- [0 0 ] % black
- [0 0 ] % white
- [0.00 1.0] % red
- [0.37 1.0] % green
- [0.60 1.0] % blue
- [0.50 1.0] % cyan
- [0.83 1.0] % magenta
- [0.16 1.0] % comment
- ] def
-
- /K {
- Colors exch get dup
- 0 get /HUE exch store
- 1 get /BRIGHT exch store
- HUE 0 eq BRIGHT 0 eq and {
- 1.0 SAT sub setgray
- } {
- HUE SAT BRIGHT sethsbcolor
- } ifelse
- } def
- /KT /K load def
- /mysetgray {
- /SAT exch 1.0 exch sub store
- HUE 0 eq BRIGHT 0 eq and {
- 1.0 SAT sub setgray
- } {
- HUE SAT BRIGHT sethsbcolor
- } ifelse
- } bind def
- } {
- /mysetgray /setgray load def
- /K /pop load def
- /KT /pop load def
- } ifelse
-
- %
- % pattern filling has to use setgray, so we keep track of what the
- % gray value should really be.
- %
- /G { /savedgray exch def savedgray mysetgray } def
-
- % 29July1994 wiml@omni #84386
- % Only define setpattern if we're using the setscreen hack.
- FmHavePSL2 not
- {
- /setpattern { % <0F1E3C78F0E1C387> 8 1
- % orgfreq organgle orgproc cvx setscreen
- /bwidth exch def
- /bpside exch def
- /bstring exch def
- /onbits 0 def
- /offbits 0 def
- freq sangle landscape {90 add} if
- {
- /y exch def
- /x exch def
- /xindex x 1 add 2 div bpside mul cvi def
- /yindex y 1 add 2 div bpside mul cvi def
- bstring yindex bwidth mul xindex 8 idiv add get
- 1 7 xindex 8 mod sub bitshift and 0 ne
- {/onbits onbits 1 add def 1}
- {/offbits offbits 1 add def 0}
- ifelse
- } setscreen
- % 29Jul94 wiml@omni #84386 Taking a hint from the Sun port,
- % we blow away the transfer function instead of trying to
- % use a precalculated inverse.
- { } settransfer
- offbits dup onbits add div mysetgray
- % tran offbits 64 mul offbits onbits add div cvi get mysetgray
- } bind def
- }
- if
-
- /myfonts [] def
- /procarray 30 array def
- 3.86 setmiterlimit
-
- /currentpat -1 def
- /orgxfer currenttransfer cvlit def
- FmHavePSL2
- {
- currenthalftonephase
- /orgphasey exch def
- /orgphasex exch def
- } {
- currentscreen cvlit
- /orgproc exch def
- /organgle exch def
- /orgfreq exch def
- } ifelse
-
-
-
- %
- % make sure we are setup for the current desired pattern fill
- %
- /checkpat {
- graymode currentpat desiredpat ne or {
- patoffsetx patoffsety sethalftonephase
- 0 mysetgray
- currentcolor pats desiredpat get setpattern
- /graymode false store
- /currentpat desiredpat store
- } if
- } {
- graymode currentpat desiredpat ne or {
- pats desiredpat get exec
- /graymode false store
- /currentpat desiredpat store
- } if
- } FmHavePSL2 not { exch } if pop bind def
-
- FmHavePSL2
- {
- /patfill
- {
- gsave
- 1 setgray fill
- grestore
- fill
- } bind def
-
- /rectpatfill
- {
- gsave
- 1 setgray 4 copy rectfill
- grestore
- rectfill
- } bind def
-
- /rectpatstroke
- {
- gsave
- 1 setgray 4 copy rectstroke
- grestore
- rectstroke
- } bind def
- }
- {
- /patfill /fill load def
- /rectpatfill /rectfill load def
- /rectpatstroke /rectstroke load def
- } ifelse
-
- %/checkpat {
- % graymode currentpat desiredpat ne or {
- % pats desiredpat get exec
- % /graymode false store
- % /currentpat desiredpat store
- % } if
- %} bind def
-
-
- /Z { checkpat patfill } bind def
-
- %
- % make sure we are setup to gray ink
- %
- /checkink {
- graymode not {
- FmHavePSL2
- { orgphasex orgphasey sethalftonephase }
- { orgfreq organgle orgproc cvx setscreen
- orgxfer cvx settransfer } ifelse
- /graymode true store
- savedgray mysetgray
- } if
- } bind def
-
-
- /F {
- checkink fill
- } bind def
-
- /dorectfill {
- checkink rectfill
- } bind def
-
- /dorectstroke {
- checkink rectstroke
- } bind def
-
- /S {
- checkink stroke
- } bind def
-
-
- /FmEncoding [
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl
- /numbersign /dollar /percent /ampersand /quotesingle /parenleft
- /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one
- /two /three /four /five /six /seven /eight /nine /colon /semicolon
- /less /equal /greater /question /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 /bracketleft /backslash
- /bracketright /asciicircum /underscore /grave /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 /braceleft /bar
- /braceright /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute
- /Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis
- /atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis
- /iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve
- /ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex
- /udieresis /dagger /.notdef /cent /sterling /section /bullet
- /paragraph /germandbls /registered /copyright /trademark /acute
- /dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef
- /yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown
- /exclamdown /logicalnot /.notdef /florin /.notdef /.notdef
- /guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde
- /Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright
- /quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis
- /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl
- /periodcentered /quotesinglbase /quotedblbase /perthousand
- /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute
- /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve
- /Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron
- /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
- ] def
-
- /FmEncode { % basefontdict => newfontdict
- /basefontdict exch def
- /newfontdict basefontdict maxlength 3 add dict def
- basefontdict {
- exch dup /FID ne {
- dup /Encoding eq {
- exch pop FmEncoding
- } {
- exch
- } ifelse
- newfontdict 3 1 roll put
- } {
- pop pop
- } ifelse
- } forall
- newfontdict
- } def
-
- /rrectpath { % r x y w h => - (make a round rect path)
- smat
- 4 2 roll TR % r w h
- /h exch def /w exch def /r exch def
- mark
- r 0 M
- w 0 w h r arcto w h 0 h r arcto
- 0 h 0 0 r arcto 0 0 w 0 r arcto C
- cleartomark
- rmat
- } def
-
- /RF { % r x y w h
- rrectpath F
- } bind def
-
- /RP { % r x y w h
- checkpat rrectpath patfill
- } bind def
-
- /RS { % r x y w h
- rrectpath S
- } bind def
-
- /RQ { % r x y w h
- checkpat rrectpath A patfill
- } bind def
-
- /NF { % x y w h
- dorectfill
- } bind def
-
- /NR { % w h x y
- checkpat
- 4 2 roll
- rectpatfill
- } bind def
-
- /W { % x y w h
- savedgray 5 1 roll 1.0 G dorectfill G } bind def
-
- /PP { % int n
- newpath
- 3 1 roll M 1 sub
- { lineto } repeat
- } bind def
-
- /SP { % int n
- 3 1 roll M 3 div cvi
- { curveto } repeat
- } bind def
-
- /rectpath { % w h x y
- M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
- } def
-
- /N { % x y w h
- dorectstroke
- } bind def
-
- /NQ { % int w, int h, int x, int y
- checkpat
- 4 2 roll
- rectpatstroke
- } bind def
-
- % fill a box with a pattern
- /replbox { % string datastring, string proc, int w, int h, int x, int y
- M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
- currentgray .5 setgray fill setgray pop pop
- } def
-
- /graybox { % x y w h => -
- currentgray 5 1 roll
- .6666666 setgray rectfill setgray
- } bind def
-
- /darkgraybox { % x y w h => -
- currentgray 5 1 roll
- .333333 setgray rectfill setgray
- } bind def
-
- /arcpath { % int th, int dth, int w, int h, int x, int y
- newpath
- TR
- /h exch def
- /w exch def
- /dth exch def
- /th exch def
- 90 th dth add sub 90 th sub % theta1 theta2
- dth 0 lt
- { exch } if
- 1 h w div neg scale
- 0 0 w 2 div 5 -2 roll arc
- } def
-
- /AS { % int th, int dth, int w, int h, int x, int y
- smat
- arcpath
- rmat
- S
- } bind def
-
- /AP { % int th, int dth, int w, int h, int x, int y
- checkpat
- smat
- arcpath
- rmat
- A patfill
- } bind def
-
- /AF { % int th, int dth, int w, int h, int x, int y
- smat
- arcpath
- 0 0 lineto
- rmat
- F
- } bind def
-
- /AQ { % int th, int dth, int w, int h, int x, int y
- checkpat
- smat
- arcpath
- 0 0 lineto
- rmat
- patfill
- } bind def
-
- /mymakefont { % i name size
- /size exch def
- /name exch def
- /i exch def
- /myfontdict name cvn findfont def
- %
- % FrameMaker provides its own encoding vector for fonts in which
- % normal alphabetic characters are printed (it doesn't change the
- % encoding vector for Symbol fonts). The way we detect an
- % alphabetic character font is by name: if the encoding vector
- % is either StandardEncoding (Adobe's standard) or NextStepEncoding
- % (the default on the NeXT system), then it's assume it's for
- % alphabetic characters, and re-encode it.
- %
- % This first part is concerned with discovering the encoding vector's
- % name and comparing it to StandardEncoding and NextStepEncoding.
- % The process is complicated by the fact that not every printer
- % understands NextStepEncoding.
- % Leave on the stack 1 or 0, telling whether we need to re-encode.
- %
- % A better way to do this might be to have FrameMaker pass to
- % mymakefont a flag indicating that "you need to re-encode."
- %
- myfontdict begin
- Encoding StandardEncoding eq
- /NextStepEncoding where { pop Encoding NextStepEncoding eq or } if
- end % myfontdict
- %
- % Based on the 1 or 0 atop the stack, re-encode if necessary.
- %
- {
- myfontdict FmEncode /gfontdict exch def
- /gfontdict (F ) dup 1 i ( ) cvs putinterval cvn
- gfontdict definefont def
- } {
- /gfontdict myfontdict def
- } ifelse
-
- /myfonts [ myfonts aload pop null ] def
- myfonts i gfontdict [size 0 0 size neg 0 0 ] makefont put
- } def
-
- /mymakefontmetric { % i name size printermetrics
- /BitmapWidths exch 0 eq def % the font reencoding will add this to font
- mymakefont
- } def
-
- /FF { % i
- myfonts exch get setfont
- } bind def
-
- /cliptowindow {
- initclip
- } def
-
- /beginprintcode { % -x -y w h scale dx dy
- GS
- newpath 1 setlinewidth 0 SL 0 setlinejoin
- [] 0 setdash 0 setgray 10 setmiterlimit
- /FMdicttop countdictstack 1 add def % high-water mark of dict stack
- /FMoptop count 7 sub def % tricky! 7 params on stack, plus "/FMoptop"
- 200 dict begin
- /showpage {} def
- TR % translate to bottom left
- dup neg scale % convert to postscript coordinates
- 0.0 0.0 M
- } def
-
- /endprintcode {
- count -1 FMoptop {pop pop} for % clear user junk from operand stack
- countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
- GR
- } def
-
- /beginPSInsetprintcode {
- /pinsetsave save def
- newpath 1 setlinewidth 0 setlinecap 0 setlinejoin
- [] 0 setdash 0 setgray 10 setmiterlimit
- /FMdicttop countdictstack 1 add def % high-water mark of dict stack
- /FMoptop count def % tricky! +1 in both cases for the 'for' loop.
- 200 dict begin
- /showpage {} def
- /showimage {} def
- } def
-
- /endPSInsetprintcode {
- count -1 FMoptop {pop pop} for % clear user junk from operand stack
- countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
- pinsetsave restore
- } def
-
- /cacheimage { % destX destY destWidth destHeight w h bps theta flip
- /flip exch def
- /theta exch def
- /bps exch def
- /h exch def
- /w exch def
- /destHeight exch def
- /destWidth exch def
- /destY exch def
- /destX exch def
- /rowbytes w bps mul 7 add 8 idiv def
- /buffer rowbytes string def
-
- GS
- destX destY TR
- theta rotate
- destWidth flip {neg} if destHeight scale
- w h bps
- % [w 0 0 h neg 0 h ]
- [w 0 0 h 0 h ]
- { currentfile buffer readhexstring pop } bind
- image
- GR
- } def
-
- /inch{72 mul}def
- /paperheight 0 def /paperwidth 0 def
- /pagedimen {
- paperheight sub abs 16 lt exch
- paperwidth sub abs 16 lt and
- {/papername exch def} {pop} ifelse
- } def
- /setpapername {
- /papersizedict 14 dict def
- papersizedict begin
- /papername /unknown def
- /Letter 8.5 inch 11.0 inch pagedimen
- /LetterSmall 7.68 inch 10.16 inch pagedimen
- /Tabloid 11.0 inch 17.0 inch pagedimen
- /Ledger 17.0 inch 11.0 inch pagedimen
- /Legal 8.5 inch 14.0 inch pagedimen
- /Statement 5.5 inch 8.5 inch pagedimen
- /Executive 7.5 inch 10.0 inch pagedimen
- /A3 11.69 inch 16.5 inch pagedimen
- /A4 8.26 inch 11.69 inch pagedimen
- /A4Small 7.47 inch 10.85 inch pagedimen
- /B4 10.125 inch 14.33 inch pagedimen
- /B5 7.16 inch 10.125 inch pagedimen
- end
- } def
- /papersize {
- papersizedict begin
- /Letter {lettertray letter} def
- /LetterSmall {lettertray lettersmall} def
- /Tabloid {11x17tray 11x17} def
- /Ledger {ledgertray ledger} def
- /Legal {legaltray legal} def
- /Statement {statementtray statement} def
- /Executive {executivetray executive} def
- /A3 {a3tray a3} def
- /A4 {a4tray a4} def
- /A4Small {a4tray a4small} def
- /B4 {b4tray b4} def
- /B5 {b5tray b5} def
- /unknown {unknown} def
- papersizedict dup papername known {papername} {/unknown} ifelse get
- end
- /FMdicttop countdictstack 1 add def
- statusdict begin stopped end
- countdictstack -1 FMdicttop {pop end} for
- } def
- /manualpapersize {
- papersizedict begin
- /Letter {letter} def
- /LetterSmall {lettersmall} def
- /Tabloid {11x17} def
- /Ledger {ledger} def
- /Legal {legal} def
- /Statement {statement} def
- /Executive {executive} def
- /A3 {a3} def
- /A4 {a4} def
- /A4Small {a4small} def
- /B4 {b4} def
- /B5 {b5} def
- /unknown {unknown} def
- papersizedict dup papername known {papername} {/unknown} ifelse get
- end
- stopped
- } def
- /desperatepapersize {
- statusdict /setpageparams known {
- paperwidth paperheight 0 1
- statusdict begin
- {setpageparams} stopped pop
- end
- } if
- } def
- /manualfeed false def
-
- % sbs 910917
- /FmHorrible {
- 4 dict begin
- /execuserobject {pop} def
- /undefineuserobject {pop} def
- /termwindow {} def
- /currentgstate {null} def
- } def
- /FmEndHorrible {
- end
- } def
-
- end % of FrameDict definitions
-
- % This name needs to be outside FrameDict because it's called by
- % NeXT code outside any printable page.
- /FmConfigurePaper { % width height name manualfeed FmConfigurePaper -
- FrameDict begin
- pop % sacrifice manualfeed, for now.
- pop % sacrifice name, for now.
- /paperheight exch def /paperwidth exch def
- setpapername
- manualfeed {true} {papersize} ifelse
- {manualpapersize} {false} ifelse
- {desperatepapersize} if
- end
- } def
-
-
- %
- % OPI stuff
- %
- /ALDsave FMLOCAL
- /ALDmatrix matrix def ALDmatrix currentmatrix pop
-
- /StartALD {
- /ALDsave save def
- savematrix
- ALDmatrix setmatrix
- } bind def
-
- /InALD {
- restorematrix
- } bind def
-
- /DoneALD {
- ALDsave restore
- } bind def
-
- % OPI end
-