home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3.4.17 [SPARC, PA-RISC] / nextstep33_risc.iso / NextLibrary / TeX / tex / src / texview / tex.psw < prev    next >
Encoding:
Text File  |  1992-05-01  |  4.4 KB  |  173 lines

  1. /*
  2.  *   Call me at the beginning to set up the basic stuff.
  3.  */
  4. defineps TPSinit()
  5.    /TeXDict 1000 dict def
  6.    TeXDict begin
  7.    /B { bind def } def
  8.    /N { def } def
  9.    /S { exch } def
  10.    /X { S N } B
  11.    /TR { translate } def
  12.    /ch-image {ch-data 0 get} B
  13.    /ch-width {ch-data 1 get} B
  14.    /ch-height {ch-data 2 get} B
  15.    /ch-xoff  {ch-data 3 get} B
  16.    /ch-yoff  {ch-data 4 get} B
  17.    /ch-tfmw  {ch-data 5 get} B
  18.    /CharBuilder
  19.         {save 3 1 roll exch /BitMaps get exch get /ch-data exch def
  20.          ch-data null ne
  21.          {ch-tfmw 0 ch-xoff neg ch-yoff neg ch-width ch-xoff sub ch-height ch-yoff sub
  22.                setcachedevice
  23.            ch-width ch-height true [1 0  0 1  ch-xoff ch-yoff]
  24.                {ch-image} imagemask
  25.         }if
  26.         restore
  27.    } B
  28.    /TeXfontasize 50 def
  29.    /TeXfonta TeXfontasize array def
  30.    /bop { 0 0 moveto } B
  31.    /eop { } B
  32.    /TeXEncoding 256 array def
  33.    0 1 255 {TeXEncoding exch 1 string dup 0 3 index put cvn put} for
  34.    /m { moveto } def
  35.    /s {show} def
  36.    /sf { TeXfonta exch get setfont } B
  37.    /q { exch show 0 rmoveto } B
  38.    /dc { nn /BitMaps get 3 1 roll put } B
  39.    /ITF {
  40.       curid TeXfontasize ge
  41.       { /TeXfontasize TeXfontasize 2 mul def
  42.         TeXfonta TeXfontasize array dup /TeXfonta exch def copy pop } if
  43.         TeXfonta exch curid exch put } B
  44.     /nn 0 def
  45.     /BTF {
  46.     /nn 7 dict def
  47.     nn begin
  48.         /FontType 3 def
  49.         /FontMatrix [1 0 0 -1 0 0] def
  50.         /FontBBox [0 0 1 1] def
  51.         /BitMaps 256 array def
  52.         /BuildChar {CharBuilder} def
  53.         /Encoding TeXEncoding def
  54.         end
  55. %    fontname { /foo setfont }
  56. %       2 array copy cvx def
  57. %    fontname load 
  58. %       0 nn put } B
  59.      } B
  60.    /MockPic {
  61.       rwiSeen rhiSeen or {
  62.          gsave newpath llx lly moveto urx lly lineto urx ury lineto
  63.          llx ury lineto closepath 0.3333 setgray fill grestore
  64.       } if
  65.    } def
  66. endps
  67. /*
  68.  *   When you go to define a font, call me next.  Pass me an integer
  69.  *   id you'll use to select me, a name (arbitrary but must be unique)
  70.  *   and a length for that name.
  71.  *
  72.  *   We cheat a bit and escape from the current page context.
  73.  */
  74. defineps TPSdf(int id)
  75. %    /fontname (name) N /curid id N BTF
  76.      /curid id N BTF
  77. endps
  78. /*
  79.  *   As soon as you're finished defining all the characters in a
  80.  *   font, call me.  I actually build the font (which marks the
  81.  *   dictionary as read-only.)
  82.  */
  83. defineps TPSdfe()
  84.    nn dup definefont ITF
  85. endps
  86. /*
  87.  *   As soon as you're finished defining all the characters in a
  88.  *   font, call me.  I actually build the font (which marks the
  89.  *   dictionary as read-only.)
  90.  */
  91. defineps TPSrfe(int id)
  92.    /curid id N load 0 get ITF
  93. endps
  94. /*
  95.  *   If you want to scale a font, call me at the end instead.
  96.  */
  97. defineps TPSdfes(int dpi, pkdpi)
  98.    dpi pkdpi div 0 1 255 { nn /BitMaps get exch get 
  99.    dup type /arraytype eq { dup 5 get 2 index div 5 exch put } { pop } ifelse } for
  100.    nn dup definefont exch scalefont ITF
  101. endps
  102. /*
  103.  *   To select a font when printing, call me with the id.  It's a
  104.  *   simple array lookup, so it's not impossibly slow.
  105.  */
  106. defineps TPSselfont(int id)
  107.    id sf
  108. endps
  109. /*
  110.  *   When defining each character in a font, call me.  chardata is
  111.  *   the binary data, and len is the length of that binary data.
  112.  *   w, h, x, y, and e are the width, height, x-offset, y-offset,
  113.  *   and escapement.  charcode is the character code.
  114.  */
  115. defineps TPSdc(char chardata[len]; int len; int w, h, x, y, e, charcode)
  116.     charcode [ (chardata) w h x y e ] dc
  117. endps
  118. /*
  119.  *   Call me at the beginning of each page.  We don't want to run out of
  120.  *   virtual memory!
  121.  */
  122. defineps TPSbop()
  123.     bop
  124. endps
  125. /*
  126.  *   Call me at the end of each page.
  127.  */
  128. defineps TPSeop()
  129.     eop
  130. endps
  131. /*
  132.  *   Shows a string, possibly containing null characters.
  133.  */
  134. defineps TPSshow(char str[len]; int len)
  135.    (str)s
  136. endps
  137. /*
  138.  *   Goes to a particular place.
  139.  */
  140. defineps TPSmoveto(int x; int y)
  141.    x y m
  142. endps
  143. /*
  144.  *   Makes a small horizontal move.
  145.  */
  146. defineps TPShmove(int x)
  147.    x 0 rmoveto
  148. endps
  149. /*
  150.  *   Shows a string and goes to a place, conceivably quickly.
  151.  */
  152. defineps TPSQshow(char str[len]; int len; int x)
  153.    (str)x q
  154. endps
  155. /*
  156.  *   Shows a string using xshow.
  157.  */
  158. defineps TPSxshow(char str[len]; int numstring far[len]; int len)
  159.    (str) far xshow
  160. endps
  161. /*
  162.  *   Defines resolution
  163.  */
  164. defineps TPSdefres(double res)
  165.    res dup /VResolution exch def /Resolution exch def
  166. endps
  167. /*
  168.  *   Defines the dvi magnification
  169.  */
  170. defineps TPSdvimag(double mag)
  171.    /DVImag mag def
  172. endps
  173.