home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / t / t146 / 2.img / SK2-4.ZIP / PREAMBLE.BGI < prev    next >
Encoding:
Text File  |  1991-01-11  |  13.6 KB  |  721 lines

  1. %*****************************************************************
  2. % File: preamble.bgi
  3. % Postscript preamble file for BGI Postscript driver
  4. % (c) Copyright 1989 Borland International
  5. % Last Update: 1-31-90  international
  6. %*****************************************************************
  7. %%EndComments
  8.  
  9. save
  10.  
  11. /dic 12 dict def
  12.  
  13. /RES
  14. {
  15.    dic begin
  16.    /cn exch def
  17.    /new exch def
  18.    /bf exch def
  19.  
  20.    /bd bf findfont def
  21.    /fo bd maxlength dict def
  22.  
  23.    bd
  24.    {
  25.      exch dup /FID ne
  26.      {
  27.        dup /Encoding eq
  28.        {
  29.      exch dup length array copy
  30.      fo 3 1 roll put
  31.        }
  32.        {
  33.      exch fo 3 1 roll put
  34.        }
  35.        ifelse
  36.      }
  37.      {
  38.        pop pop
  39.      }
  40.      ifelse
  41.    }
  42.    forall
  43.  
  44.    fo /FontName new put
  45.    cn aload pop
  46.  
  47.    cn length 2 idiv
  48.    {
  49.      fo /Encoding get 3 1 roll put
  50.    }
  51.    repeat
  52.  
  53.    new fo definefont pop
  54.    end
  55. } def
  56.  
  57. % 1-30-90
  58. /pcVector [
  59.  16#00 /circumflex 16#01 /grave 16#02 /dieresis 16#03 /tilde 16#04 /acute 
  60.  16#05 /cedilla  16#06 /ring 16#07 /slash 16#08 /caron
  61.  16#80 /Ccedilla 16#81 /udieresis 16#82 /eacute 16#83 /acircumflex 
  62.  16#84 /adieresis 16#85 /agrave 16#86 /aring 16#87 /ccedilla 
  63.  16#88 /ecircumflex 16#89 /edieresis 16#8a /egrave 16#8b /idieresis 
  64.  16#8c /icircumflex 16#8d /igrave 16#8e /Adieresis 16#8f /Aring 
  65.  16#90 /Eacute 16#91 /ae 16#92 /AE 16#93 /ocircumflex 
  66.  16#94 /odieresis 16#95 /ograve 16#96 /ucircumflex 16#97 /ugrave 
  67.  16#98 /ydieresis 16#99 /Odieresis 16#9a /Udieresis 16#9b /oslash
  68.  16#9c /sterling 16#9d /Oslash 16#9f /florin 16#a0 /aacute 
  69.  16#a1 /iacute 16#a2 /oacute 16#a3 /uacute 16#a4 /ntilde 
  70.  16#a5 /Ntilde 16#a6 /ordfeminine 16#a7 /ordmasculine 16#a8 /questiondown 
  71.  16#ad /exclamdown 16#ae /guillemotleft 16#af /guillemotright 16#b0 /space
  72.  16#b1 /space 16#b2 /space 16#b3 /space 16#b7 /idieresis 
  73.  16#b9 /Agrave    16#ba /currency 16#bb /sterling 16#bc /Ecircumflex 
  74.  16#bd /section 16#be /Acircumflex 16#bf /Egrave 16#c0 /yen 
  75.  16#c2 /cent 16#c3 /Ugrave 16#c8 /atilde 16#cb /space 
  76.  16#d1 /Icircumflex 16#d2 /atilde 16#d3 /otilde 16#d4 /scaron 
  77.  16#d5 /zcaron 16#d6 /Ydieresis 16#da /Atilde     16#df /Ocircumflex
  78.  16#e0 /a 16#e1 /b 16#e2 /c 16#e3 /p 16#e4 /s 
  79.  16#e5 /s 16#e6 /m 16#e7 /t 16#e9 /t 
  80.  16#ea /o 16#eb /d 16#ec /i 16#ed /Oslash 
  81.  16#ee /e 16#f0 /Aacute 16#f1 /germandbls
  82. ] def
  83. % end 1-30-90
  84.  
  85. /OP
  86. {
  87.   bgiFill 0 ne bgiRes 0 eq and bgiFill 1 eq or           % 1 = SolidFill
  88.   {
  89.     1 CurrentFill ne
  90.     {
  91.       level0
  92.     } if
  93.     bgiFillColor                % stack: (color)
  94.     dup /CurrentColor exch def                  % set color
  95.     bgiRes 1 eq
  96.     {
  97.       bgiGrayTable exch get setgray
  98.     }
  99.     {
  100.       setbgicolor
  101.     } ifelse
  102.   }{
  103.     % stack:  -
  104.     0 bgiFill eq                % 0 = HollowFill
  105.     {
  106.     }{
  107.       bgiFill dup 15 gt
  108.       {
  109.     pop
  110.       }{
  111.     % stack:  bgiFill
  112.     dup bgiRes 0 ne exch 9 ne and
  113.     {
  114.       level0
  115.       bgiPatTable exch get
  116.       setpatterndict begin
  117.         /bstring exch def
  118.  
  119.         /onbits 0 def
  120.         /offbits 0 def
  121.  
  122.         %9.375 0 /spot load setscreen
  123.         18.75 0  /spot load setscreen
  124.  
  125.         {} settransfer
  126.         offbits offbits onbits add div
  127.       end
  128.       setgray
  129.     }{
  130.       pop
  131.       level0            % for pattern 9
  132.       0.3 setgray
  133.     } ifelse
  134.       } ifelse
  135.     } ifelse
  136.   } ifelse
  137.  
  138.   /CurrentFill bgiFill def
  139.   newpath
  140. } bind def
  141.  
  142.  
  143. /toStack
  144. {
  145.   bgiMono
  146.   bgiFill
  147.   bgiColor
  148.   bgiFillColor
  149.   bgiSize
  150.   bgiFont
  151.   bgiAttrib
  152.   bgiOrient
  153.   bgiRes
  154.   x0Clip
  155.   y0Clip
  156.   x1Clip
  157.   y1Clip
  158. } def
  159.  
  160. /fromStack
  161. {
  162.   /y1Clip exch def
  163.   /x1Clip exch def
  164.   /y0Clip exch def
  165.   /x0Clip exch def
  166.   /bgiRes exch def
  167.   /bgiOrient exch def
  168.   /bgiAttrib exch def
  169.   /bgiFont exch def
  170.   /bgiSize exch def
  171.   /bgiFillColor exch def
  172.   /bgiColor exch def
  173.   /bgiFill exch def
  174.   /bgiMono exch def
  175. } def
  176.  
  177. /level0 {
  178.   toStack
  179.   Memory0 restore
  180.   fromStack
  181.  
  182.   /Memory0 save def
  183.  
  184.   newpath
  185.   x0Clip y0Clip moveto
  186.   x0Clip y1Clip lineto
  187.   x1Clip y1Clip lineto
  188.   x1Clip y0Clip lineto
  189.   closepath
  190.   clip
  191.   newpath
  192.  
  193.   /Memory1 save def
  194.   /CurrentFont -1 def
  195.   /CurrentColor 0 def
  196. } def
  197.  
  198. /CL {
  199.   closepath
  200.   dup 1 eq
  201.   { DO } if
  202.   dup 2 eq
  203.   { gsave
  204.       0 CurrentFill ne                      % 0 = Hollow fill
  205.       {
  206.     fill
  207.       } if
  208.    grestore DO
  209.   } if
  210.   3 eq
  211.   {
  212.     0 CurrentFill ne                    % 0 = Hollow fill
  213.     {
  214.       fill
  215.     } if
  216.   } if
  217.  
  218. } bind def
  219.  
  220. /DO                           % draw outline
  221. {
  222.   bgiMono false eq
  223.   {
  224.      % color printer
  225.      bgiColor setbgicolor
  226.  
  227.   }
  228.   {
  229.     0.0 setgray
  230.   } ifelse
  231.   stroke
  232. } def
  233.  
  234. /setpatterndict 18 dict def
  235.  
  236. /spot
  237. {
  238.     1 add 4 mul cvi
  239.     exch
  240.     1 add 4 mul cvi
  241.     /xbit exch def
  242.     /ybit exch def
  243.     bstring ybit xbit -3 bitshift add get
  244.     1 7 xbit 7 and sub bitshift
  245.  
  246.     and 0 ne
  247.  
  248.     { /onbits onbits 1 add def 1}
  249.     { /offbits offbits 1 add def 0}
  250.     ifelse
  251. } bind def
  252. /bgiFontTable
  253. [
  254.    [ /AvantGarde-Book -96 58 739]
  255.    [ /AvantGarde-BookOblique -96 58 739]
  256.    [ /AvantGarde-Demi -92 90 739]
  257.    [ /AvantGarde-DemiOblique -92 90 39]
  258.    [ /Bookman-Demi -121 106 725]
  259.    [ /Bookman-DemiItalic -106 106 732]
  260.    [ /Bookman-Light -125 60 717]
  261.    [ /Bookman-LightItalic -110 60 717]
  262.    [ /Courier -82 40 624]
  263.    [ /Courier-Bold -85 100 674]
  264.    [ /Courier-BoldOblique -85 100 674]
  265.    [ /Courier-Oblique -82 40 624]
  266.    [ /Helvetica -97 73 729]
  267.    [ /Helvetica-Bold -106 73 729]
  268.    [ /Helvetica-BoldOblique -106  105 729]
  269.    [ /Helvetica-Oblique -106 73 729]
  270.    [ /Helvetica-Narrow -97 73 729]
  271.    [ /Helvetica-Narrow-Bold -106 73 729]
  272.    [ /Helvetica-Narrow-BoldOblique -106 73 729]
  273.    [ /Helvetica-Narrow-Oblique -97 73 729]
  274.    [ /NewCenturySchlbk-Bold -103 106 737]
  275.    [ /NewCenturySchlbk-BoldItalic -102 54 737]
  276.    [ /NewCenturySchlbk-Italic -102 42 737]
  277.    [ /NewCenturySchlbk-Roman -103 61 737]
  278.    [ /Palatino-Bold -98 44 719]
  279.    [ /Palatino-BoldItalic -98 54 726]
  280.    [ /Palatino-Italic -138 50 733]
  281.    [ /Palatino-Roman -141 38 723]
  282.    [ /Symbol -98 54 720]
  283.    [ /Times-Bold -99 95 670]
  284.    [ /Times-BoldItalic -98 54 682]
  285.    [ /Times-Italic -96 48 684]
  286.    [ /Times-Roman -109 49 682]
  287.    [ /ZapfChancery-MediumItalic -120 50 678]
  288.    [ /ZapfDingbats -98 54 720]
  289. ] def
  290.  
  291. /bgiPatTable
  292. [
  293.    <0000000000000000>
  294.    <ffffffffffffffff>
  295.    <ffff0000ffff0000>
  296.    <0102040810204080>
  297.    <e0c183070e1c3870>
  298.    <f0783c1e0f87c3e1>
  299.    <a5d269b45a2d964b>
  300.    <ff888888ff888888>
  301.    <8142241818244281>
  302.    <cc33cc33cc33cc33>
  303.    <8000080080000800>
  304.    <8800220088002200>
  305.    <dd8b078edde870b8>
  306.    <dfdfdf00fbfbfb00>
  307.    <081c22c180010204>
  308.    <0001020400402010>
  309. ] def
  310.  
  311. /bgiGrayTable
  312. [ 1.00 0.11 0.59 0.70 0.30 0.41 0.40 1.00 0.50 0.40 0.73 0.80 0.53 0.60 0.93
  313.   0.00    ] def
  314.  
  315. /bgiColorTable
  316. [
  317.   [1 1 1]              % white
  318.   [0 0 1]              % blue
  319.   [0 1 0]              % green
  320.   [0 1 1]              % cyan
  321.   [1 0 0]              % red
  322.   [1 0 1]
  323.   [0.67  0.33  0]          % brown
  324.   [1 1 1]              % white
  325.   [0.9 0.9 0.9]              % gray
  326.   [0.33 0.33 1]              % lightblue
  327.   [0.33  1 0.33]          % lightgreen
  328.   [0.33 1 1]              % lightcyan
  329.   [1 0.33  0.33]          % lightred
  330.   [1 0.33  1]              % lightmagenta
  331.   [1 1 0.33]              % yellow
  332.   [0 0 0]              % black
  333.   [0.75 0.75 0.75]             % gray (color 7 on color printers)
  334. ] def
  335.  
  336. /MT /moveto load def
  337. /LT /lineto load def
  338. /CP /closepath load def
  339. /NP /newpath load def
  340. /SD /setdash load def
  341. /SG /setgray load def
  342. /TR /translate load def
  343. /LW /setlinewidth load def
  344.  
  345. /DL
  346. {
  347.   moveto
  348.   lineto
  349.   DO
  350. } bind def
  351.  
  352. /TW
  353. {
  354.   20 div exch 20 div exch moveto
  355.   20 div exch 20 div exch lineto
  356.   DO
  357. } bind def
  358.  
  359. /TB
  360. {
  361.   20 div 4 1 roll
  362.   20 div 4 1 roll
  363.   20 div 4 1 roll
  364.   20 div 4 1 roll
  365.   DB
  366. } bind def
  367.  
  368. /SC
  369. {
  370.   /y1Clip exch def
  371.   /x1Clip exch def
  372.   /y0Clip exch def
  373.   /x0Clip exch def
  374.   level0
  375. } bind def
  376.  
  377. /ellipsedict 12 dict def
  378. ellipsedict /mtrx matrix put
  379.  
  380. /SA                      % stack:    x y xrad yrad start delta
  381. {
  382. % add an arc to the current path
  383.   ellipsedict begin
  384.     /delta exch 60.0 div def
  385.     /startangle exch 60.0 div def
  386.     /yrad exch def
  387.     /xrad exch def
  388.     /y exch def
  389.     /x exch def
  390.  
  391.     /endangle startangle delta add def
  392.     /savematrix mtrx currentmatrix def
  393.     x y translate
  394.     xrad yrad scale
  395.     0 0 1
  396.     delta 0 gt
  397.     {startangle endangle arc }
  398.     {startangle endangle arcn}
  399.     ifelse
  400.     savematrix setmatrix
  401.   end
  402. } bind def
  403.  
  404. /DOARC                           % stack:  x y xrad yrad start end
  405. {
  406. % add an arc to the current path
  407.   ellipsedict begin
  408.     /endangle exch def
  409.     /startangle exch def
  410.  
  411.     bgiOrient 0 ne
  412.     { exch } if
  413.     /yrad exch def
  414.     /xrad exch def
  415.     /y exch def
  416.     /x exch def
  417.  
  418.     /savematrix mtrx currentmatrix def
  419.     x y translate
  420.     xrad yrad scale
  421.     0 0 1 startangle endangle arc
  422.     savematrix setmatrix
  423.   end
  424. } bind def
  425.  
  426. /FE                   % stack:  x y xrad yrad  for ellipse
  427. {
  428.   gsave
  429.     OP
  430.     0 360 DOARC
  431.     3 CL
  432.   grestore
  433.   DO
  434. } bind def
  435.  
  436.  
  437. /DB                       % stack:    x1 y1 x0 y0 color
  438. {
  439.   OP
  440.   /y0 exch def
  441.   /x0 exch def
  442.   /y1 exch def
  443.   /x1 exch def
  444.   newpath
  445.   x0 y0 moveto x0 y1 lineto x1 y1 lineto x1 y0 lineto
  446.   3 CL
  447. } bind def
  448.  
  449. /DF                       % stack: (attrib) (size) (font)
  450. {
  451.   /bgiFont exch def
  452.   % dup 6 eq {pop 7} if
  453.   /bgiSize exch def
  454.   /bgiAttrib exch def
  455. } bind def
  456.  
  457. /FP                           % stack: (fill #)
  458. {
  459.   dup 15 le
  460.   {
  461.     /bgiFill exch def
  462.   }{
  463.     pop
  464.   } ifelse
  465. } bind def
  466.  
  467. /CO {                % stack: (color) (fill color)
  468.   dup 15 le
  469.   { /bgiFillColor exch def}
  470.   {pop} ifelse
  471.   dup 15 le
  472.   { /bgiColor exch def}
  473.   {pop} ifelse
  474. } bind def
  475.  
  476. /ST                           % start text
  477.                         % stack: -
  478. {
  479.   CurrentSize bgiSize ne CurrentFont bgiFont ne or
  480.   {
  481.     currentpoint
  482.     toStack
  483.     Memory1 restore
  484.     fromStack
  485.     moveto
  486.  
  487.  
  488.     /Memory1 save def
  489.     /CurrentColor 0 def
  490.  
  491.     bgiFont dup /CurrentFont exch def
  492.  
  493. % 1-4-90  don't reencode Symbol or ZapfDingbats fonts;
  494.     dup dup 34 ne exch 28 ne and /bRES exch def
  495. % end 1-4-90
  496.  
  497.     dup dup 8 ge exch 15 le  and
  498.     {
  499.       dup 8 eq        % courier
  500.       { 0.93 }
  501.       {
  502.     dup 9 eq        % courier-bold
  503.     { 0.94 }
  504.     {
  505.         dup   11 eq        % courier-bolditalic (1.02 expansion)
  506.         {  0.95  }
  507.         {
  508.           dup 10 eq   % courier-italic
  509.           { 0.95 }
  510.           {
  511.           dup 12 eq % helvetica
  512.           { 0.93 }
  513.           {
  514.         dup 13 eq    % helvetica-bold
  515.         { 0.96 }
  516.         {
  517.           dup 14 eq    % helvetica-bolditalic
  518.           { 0.93 }
  519.           {
  520.             dup 15 eq    % helvetica-italic (1.02 expansion)
  521.         {     0.96 }
  522.         {
  523.               1
  524.         }     ifelse
  525.           } ifelse
  526.         } ifelse
  527.           } ifelse
  528.           } ifelse
  529.       }   ifelse
  530.     } ifelse
  531.       } ifelse
  532.     }
  533.     {
  534.       dup 32 eq        % times-roman
  535.       { 1 }
  536.       {
  537.     dup 29 eq    % times-bold (1.02 expansion)
  538.     { 0.95 }
  539.     {
  540.       dup 30 eq    % times-boldoblique
  541.       { 0.91 }
  542.       {
  543.         dup 31 eq    %times-italic
  544.         { 0.92 }
  545.         {
  546.           1        % everything else
  547.         } ifelse
  548.       } ifelse
  549.     } ifelse
  550.       } ifelse
  551.     } ifelse
  552.     /CurrentCompress exch  def
  553.  
  554.     bgiFontTable exch get             % stack: [(font name) offset thick]
  555.     dup 0 get                     % stack: array fontname
  556.     exch
  557.     dup 1 get
  558.     /CurrentUnderlineOffset exch def
  559.     dup 2 get
  560.     /CurrentUnderlineThickness exch def
  561.     3 get
  562.     /CurrentAscender exch bgiSize mul 1000.0 div def
  563. % 1-4-89
  564.     bRES 
  565.     {
  566.       /thisFont pcVector RES /thisFont
  567.     } if
  568. % end 1-4-89
  569.     findfont
  570.  
  571.     bgiSize dup /CurrentSize exch def
  572.     scalefont setfont
  573.   } if
  574.  
  575. % set the text color or gray scale
  576.   bgiMono false eq
  577.   {
  578.     % color printer            stack:    color
  579.     setbgicolor
  580.   }
  581.   {
  582.     % mono printer
  583.     0 eq            % stack:  color
  584.     { 1.0 setgray}
  585.     { 0.0 setgray}
  586.     ifelse
  587.   } ifelse
  588. } bind def
  589.  
  590. /setbgicolor
  591. {
  592.     dup 7 eq bgiMono not and
  593.     {
  594.       pop
  595.       16
  596.     } if
  597.  
  598.      bgiColorTable exch get              % stack:    [r g b]
  599.      dup
  600.      0 get                     % stack: [r g b] r
  601.      exch
  602.      dup
  603.      1 get                     % stack: r [rgb] g
  604.      exch
  605.      2 get                     % stack: r g b
  606.      setrgbcolor
  607. } bind def
  608.  
  609. /SH             % stack:  string tdir rot justx justy
  610. {
  611.   /justy exch def
  612.   /justx exch def
  613.   90 mul /rot exch def
  614.  
  615.   0 ne        %   tdir is on the stack
  616.         %   (this will move into driver)
  617.   {
  618.     /justx 2 def
  619.   } if
  620.  
  621.   dup stringwidth pop
  622.   CurrentCompress mul
  623.   /sx exch def
  624.   sx justx mul -0.5 mul
  625.   justy 0 eq
  626.   {
  627.     0                    % baseline aligned
  628.   }
  629.   {
  630.     justy 1 eq
  631.     {
  632.       CurrentAscender 2 div neg        % center aligned
  633.     }
  634.     {
  635.       CurrentAscender neg        % top aligned
  636.     } ifelse
  637.   } ifelse
  638.  
  639.   % underlining
  640.   gsave
  641.  
  642.   rot rotate rmoveto
  643.   bgiAttrib 4 and 0 ne        % true if underlined, false otherwise
  644.   {
  645.     currentpoint
  646.     CurrentUnderlineOffset CurrentSize mul 1000.0 div add
  647.     /yval exch def
  648.     /xval exch def
  649.  
  650.     bshow
  651.     xval yval moveto
  652.     sx xval add yval lineto
  653.     CurrentUnderlineThickness CurrentSize mul 1000.0 div setlinewidth
  654.     stroke
  655.   }
  656.   {
  657.     bshow
  658.   }
  659.   ifelse
  660.   grestore
  661. } bind def
  662.  
  663. /bshow
  664. {
  665.   CurrentCompress 1 eq
  666.   {
  667.     show
  668.   }
  669.   {
  670.     dup length /len exch def
  671.     len 0 ne
  672.     {
  673.        dup stringwidth pop /wid exch def
  674.        CurrentCompress wid mul        % (factor * wid)
  675.        wid sub                    % (factor * wid) - wid
  676.        len div                    % stack:  string per_char_amt
  677.        exch
  678.        0 exch
  679.        ashow
  680.     } if
  681.   } ifelse
  682. } bind def
  683.  
  684. /colorsetup
  685. {
  686.     % exchange colors 0 and 15
  687.     bgiColorTable 0 get              % stack:  [r g b]
  688.     bgiColorTable 15 get
  689.     exch
  690.     bgiColorTable 0 put
  691.     bgiColorTable 15 put
  692. } bind def
  693.  
  694. % ---- initialization
  695.  
  696. /CurrentFill 1 def
  697. /CurrentFont -1 def
  698. /CurrentSize -1 def
  699. /CurrentColor 15 def
  700.  
  701. /bgiMono 0 def
  702. /bgiFill 1 def
  703. /bgiColor 15 def
  704. /bgiFillColor 15 def
  705. /bgiSize 10 def
  706. /bgiFont 1 def
  707. /bgiOrient 0 def
  708. /bgiRes 1 def
  709. /bgiAttrib 0 def
  710.  
  711. 1.415 setmiterlimit
  712. 0.5 setlinewidth
  713.  
  714. /Memory0 save def
  715. /Memory1 save def
  716.  
  717. 0 0 moveto
  718.  
  719. %%EndProlog
  720. 
  721.