home *** CD-ROM | disk | FTP | other *** search
- /*
- * Call me at the beginning to set up the basic stuff.
- */
- defineps TPSinit()
- /TeXDict 1000 dict def
- TeXDict begin
- /B { bind def } def
- /N { def } def
- /S { exch } def
- /X { S N } B
- /TR { translate } def
- /ch-image {ch-data 0 get} B
- /ch-width {ch-data 1 get} B
- /ch-height {ch-data 2 get} B
- /ch-xoff {ch-data 3 get} B
- /ch-yoff {ch-data 4 get} B
- /ch-tfmw {ch-data 5 get} B
- /CharBuilder
- {save 3 1 roll exch /BitMaps get exch get /ch-data exch def
- ch-data null ne
- {ch-tfmw 0 ch-xoff neg ch-yoff neg ch-width ch-xoff sub ch-height ch-yoff sub
- setcachedevice
- ch-width ch-height true [1 0 0 1 ch-xoff ch-yoff]
- {ch-image} imagemask
- }if
- restore
- } B
- /TeXfontasize 50 def
- /TeXfonta TeXfontasize array def
- /bop { 0 0 moveto } B
- /eop { } B
- /TeXEncoding 256 array def
- 0 1 255 {TeXEncoding exch 1 string dup 0 3 index put cvn put} for
- /m { moveto } def
- /s {show} def
- /sf { TeXfonta exch get setfont } B
- /q { exch show 0 rmoveto } B
- /dc { nn /BitMaps get 3 1 roll put } B
- /ITF {
- curid TeXfontasize ge
- { /TeXfontasize TeXfontasize 2 mul def
- TeXfonta TeXfontasize array dup /TeXfonta exch def copy pop } if
- TeXfonta exch curid exch put } B
- /nn 0 def
- /BTF {
- /nn 7 dict def
- nn begin
- /FontType 3 def
- /FontMatrix [1 0 0 -1 0 0] def
- /FontBBox [0 0 1 1] def
- /BitMaps 256 array def
- /BuildChar {CharBuilder} def
- /Encoding TeXEncoding def
- end
- % fontname { /foo setfont }
- % 2 array copy cvx def
- % fontname load
- % 0 nn put } B
- } B
- /MockPic {
- rwiSeen rhiSeen or {
- gsave newpath llx lly moveto urx lly lineto urx ury lineto
- llx ury lineto closepath 0.3333 setgray fill grestore
- } if
- } def
- endps
- /*
- * When you go to define a font, call me next. Pass me an integer
- * id you'll use to select me, a name (arbitrary but must be unique)
- * and a length for that name.
- *
- * We cheat a bit and escape from the current page context.
- */
- defineps TPSdf(int id)
- % /fontname (name) N /curid id N BTF
- /curid id N BTF
- endps
- /*
- * As soon as you're finished defining all the characters in a
- * font, call me. I actually build the font (which marks the
- * dictionary as read-only.)
- */
- defineps TPSdfe()
- nn dup definefont ITF
- endps
- /*
- * As soon as you're finished defining all the characters in a
- * font, call me. I actually build the font (which marks the
- * dictionary as read-only.)
- */
- defineps TPSrfe(int id)
- /curid id N load 0 get ITF
- endps
- /*
- * If you want to scale a font, call me at the end instead.
- */
- defineps TPSdfes(int dpi, pkdpi)
- dpi pkdpi div 0 1 255 { nn /BitMaps get exch get
- dup type /arraytype eq { dup 5 get 2 index div 5 exch put } { pop } ifelse } for
- nn dup definefont exch scalefont ITF
- endps
- /*
- * To select a font when printing, call me with the id. It's a
- * simple array lookup, so it's not impossibly slow.
- */
- defineps TPSselfont(int id)
- id sf
- endps
- /*
- * When defining each character in a font, call me. chardata is
- * the binary data, and len is the length of that binary data.
- * w, h, x, y, and e are the width, height, x-offset, y-offset,
- * and escapement. charcode is the character code.
- */
- defineps TPSdc(char chardata[len]; int len; int w, h, x, y, e, charcode)
- charcode [ (chardata) w h x y e ] dc
- endps
- /*
- * Call me at the beginning of each page. We don't want to run out of
- * virtual memory!
- */
- defineps TPSbop()
- bop
- endps
- /*
- * Call me at the end of each page.
- */
- defineps TPSeop()
- eop
- endps
- /*
- * Shows a string, possibly containing null characters.
- */
- defineps TPSshow(char str[len]; int len)
- (str)s
- endps
- /*
- * Goes to a particular place.
- */
- defineps TPSmoveto(int x; int y)
- x y m
- endps
- /*
- * Makes a small horizontal move.
- */
- defineps TPShmove(int x)
- x 0 rmoveto
- endps
- /*
- * Shows a string and goes to a place, conceivably quickly.
- */
- defineps TPSQshow(char str[len]; int len; int x)
- (str)x q
- endps
- /*
- * Shows a string using xshow.
- */
- defineps TPSxshow(char str[len]; int numstring far[len]; int len)
- (str) far xshow
- endps
- /*
- * Defines resolution
- */
- defineps TPSdefres(double res)
- res dup /VResolution exch def /Resolution exch def
- endps
- /*
- * Defines the dvi magnification
- */
- defineps TPSdvimag(double mag)
- /DVImag mag def
- endps
-