%! %Definitions for "IWEM" % % Imagewriter // Emulator Version 1.1 % patterned after "DaisyEm.ps" by Adobe Systems % Bill Judd Apple Peripheral Systems and Products % Copyright Apple Computer, Inc. 1986 % All Rights Reserved %--------------------------------------- % Modifiction History % 5/31/86 wbj First Release % 6/09/86 wbj Strip off high bit for Apple // printing % 7/02/86 wbj Fix graphic-printing bug % -- % % 7/10/86 Pete Mc Donald (PMM) adjusted Topofpage and LnHt, and Linect % to compensate for page only really being 10.92" % 7/12/86 PMM Add code to slash 0's (default in resetprinter else % use set switch commands to change default) % 7/17/86 PMM Add code to handle ignore/use bit 8. Default in Reset printer, % else use set switch commands to change default) % 7/17/86 PMM Add code to handle Backspace. % 7/24/86 PMM Add code to do Hex Dumps of recieved data. Mode is controlled by % a flag in reset printer, called debug? When true it will print % all recieved characters as hexadecimal else it has no effect. % 7/25/86 PMM fix bug in ChangeSwitches, where certain operations were under % the wrong switch number % -- % % 9/05/86 wbj fix blank-page-after-last-page bug % 9/11/86 wbj fix AW last-page bug % 10/04/86 wbj Let's go international! Imagewriter international character- % switching function added % 11/03/86 wbj Added bdf proc: won some VM and some speed % 11/04/86 wbj modified Moustext generation code; moved Mousetext and % graphic font generation to runtime % 11/05/86 wbj changed to table-lookup for internatonal char switching; % cut # of fonts from 32 to 4 % 11/07/86 wbj added procs to add AE and ae to Courier fonts % 11/10/86 wbj added subscript and superscript % 11/19/86 wbj headline-text function fixed % 11/25/86 wbj htabs problem fixed % 11/26/86 wbj international release today % % %----------------------------------------------------------------------------- /IWEmDict where {pop (Imagewriter emulator version 1.1 already loaded. NOT loaded again!!) print flush /Courier findfont 10 scalefont setfont 100 720 moveto (Imagewriter emulator version 1.1 already loaded. NOT loaded again!!)show showpage stop} { (Imagewriter emulator version 1.1 loading)print flush /Courier findfont 10 scalefont setfont serverdict begin statusdict begin 0 checkpassword { 100 720 moveto (Imagewriter emulator version 1.1 loaded!)show showpage 0 exitserver} { 100 720 moveto (Bad Password on loading Imagewriter emulator!!!)show showpage }ifelse end statusdict } ifelse /bdf {bind def} bind def /IWEmDict 150 dict def /_WBJ_ {IWEmDict begin save makefonts 1 1 scale printfile restore end} bdf IWEmDict begin %--------------------------------------------------------- % Setting the default language: you may change the default country by % choosing a country from the following list and replacing "USA" with % the chosen country in the command line below. Do not include the "/". % To change the default to French characters, for example, change the % command line to: /defaultcountry France def % Then, when the IWEM is loaded into a Laserwriter printer, the % selected international characters will be the default characters. % country list: DO NOT CHANGE !!! /USA 0 def /Italy 1 def /Denmark 2 def /England 3 def /Germany 4 def /Sweden 5 def /France 6 def /Spain 7 def /defaultcountry USA def % <- this is the line to change /country defaultcountry def % ============== MouseFont ==================== /BuildCharDict 20 dict def /MouseFont 20 dict def MouseFont begin /FontType 3 def /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 1 1] def /Encoding 256 array def 0 1 255 {Encoding exch /.notdef put} for Encoding dup 64 /closedApple put dup 65 /openApple put dup 66 /arrow put dup 67 /hourGlass put dup 68 /check1 put dup 69 /check2 put dup 70 /invcrArrow put dup 71 /menubar put dup 72 /leftArrow put dup 73 /elipsis put dup 74 /downArrow put dup 75 /upArrow put dup 76 /overScore put dup 77 /crArrow put dup 78 /solidRect put dup 79 /lScrollArrow put dup 80 /rScrollArrow put dup 81 /dScrollArrow put dup 82 /uScrollArrow put dup 83 /midScore put dup 84 /lLeftCorner put dup 85 /rightArrow put dup 86 /grayRect1 put dup 87 /grayRect2 put dup 88 /lFolder put dup 89 /rFolder put dup 90 /rBar put dup 91 /diamond put dup 92 /horLines put dup 93 /cross put dup 94 /button put 95 /lBar put /CharacterDefs 33 dict def CharacterDefs /.notdef {} put CharacterDefs /closedApple { 8 8 true [ 8 0 0 -8 0 8] {<08 10 6c fe fc fc 7e 6c>} imagemask } put CharacterDefs /openApple { 8 8 true [ 8 0 0 -8 0 8] {<08 10 6c 82 84 84 52 6c>} imagemask } put CharacterDefs /arrow { 8 8 true [ 8 0 0 -8 0 8] {<00 00 40 60 70 78 6c 42>} imagemask } put CharacterDefs /hourGlass { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /check1 { 8 8 true [ 8 0 0 -8 0 8] {<00 02 04 88 50 20 20 00>} imagemask } put CharacterDefs /check2 { 8 8 true [ 8 0 0 -8 0 8] {<00 02 04 88 50 20 20 00>} imagemask } put CharacterDefs /invcrArrow { 8 8 true [ 8 0 0 -8 0 8] {<02 02 02 22 62 fe 60 20>} imagemask } put CharacterDefs /menubar { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /leftArrow { 8 8 true [ 8 0 0 -8 0 8] {<10 20 40 ff 40 20 10 00>} imagemask } put CharacterDefs /elipsis { 8 8 true [ 8 0 0 -8 0 8] {<00 00 00 00 00 00 00 54>} imagemask } put CharacterDefs /downArrow { 8 8 true [ 8 0 0 -8 0 8] {<10 10 10 10 92 54 38 10>} imagemask } put CharacterDefs /upArrow { 8 8 true [ 8 0 0 -8 0 8] {<10 38 54 92 10 10 10 10>} imagemask } put CharacterDefs /overScore { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /crArrow { 8 8 true [ 8 0 0 -8 0 8] {<02 02 02 22 62 fe 60 20>} imagemask } put CharacterDefs /solidRect { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /lScrollArrow { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /rScrollArrow { 8 8 true [ 8 0 0 -8 0 8] {<93 18 1c fe 1c 18 10 ef>} imagemask } put CharacterDefs /dScrollArrow { 8 8 true [ 8 0 0 -8 0 8] {<81 89 08 7f 3e 1c 89 81>} imagemask } put CharacterDefs /uScrollArrow { 8 8 true [ 8 0 0 -8 0 8] {<81 89 1c 3e 7f 08 89 81>} imagemask } put CharacterDefs /midScore { 8 8 true [ 8 0 0 -8 0 8] {<00 00 00 ff 00 00 00 00>} imagemask } put CharacterDefs /lLeftCorner { 8 8 true [ 8 0 0 -8 0 8] {<80 80 80 80 80 80 80 ff>} imagemask } put CharacterDefs /rightArrow { 8 8 true [ 8 0 0 -8 0 8] {<10 08 04 fe 04 08 10 00>} imagemask } put CharacterDefs /grayRect1 { 8 8 true [ 8 0 0 -8 0 8] {<55 aa 55 aa 55 aa 55 aa>} imagemask } put CharacterDefs /grayRect2 { 8 8 true [ 8 0 0 -8 0 8] {<55 aa 55 aa 55 aa 55 aa>} imagemask } put CharacterDefs /lFolder { 8 8 true [ 8 0 0 -8 0 8] {<00 1f 21 20 20 20 3f 00>} imagemask } put CharacterDefs /rFolder { 8 8 true [ 8 0 0 -8 0 8] {<00 00 f8 04 04 04 fc 00>} imagemask } put CharacterDefs /rBar { 8 8 true [ 8 0 0 -8 0 8] {<01 01 01 01 01 01 01 01>} imagemask } put CharacterDefs /diamond { 8 8 true [ 8 0 0 -8 0 8] {<10 38 7c fe 7c 38 10 00>} imagemask } put CharacterDefs /horLines { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /cross { 8 8 true [ 8 0 0 -8 0 8] {<28 28 ee 00 ee 28 28 00>} imagemask } put CharacterDefs /button { 8 8 true [ 8 0 0 -8 0 8] {} imagemask } put CharacterDefs /lBar { 8 8 true [ 8 0 0 -8 0 8] {<80 80 80 80 80 80 80 80>} imagemask } put /BuildChar {BuildCharDict begin /char exch def /fontdict exch def /charname fontdict /Encoding get char get def /charproc fontdict /CharacterDefs get charname get def 1 0 0 0 1 1 setcachedevice gsave charproc grestore end } def end % ============== End of MouseFont Definition ================ /log2 128 def /mirror % n1 -- n2 reverse bits of 8-bit byte { /log2 128 store 0 exch % -- 0 n { dup 2 mod 1 eq % odd? -- 0 n f {exch log2 add exch } if % -- ans n /log2 log2 2 div store 2 idiv dup 0 eq { pop exit} if } loop 1 idiv } bdf % ============== GrafFont ===================== /BuildCharDict 20 dict def /GrafFont 20 dict def GrafFont begin /FontType 3 def /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 1 8] def /Encoding 256 array def /c0 /c1 /c2 /c3 /c4 /c5 /c6 /c7 /c8 /c9 /c10 /c11 /c12 /c13 /c14 /c15 /c16 /c17 /c18 /c19 /c20 /c21 /c22 /c23 /c24 /c25 /c26 /c27 /c28 /c29 /c30 /c31 /c32 /c33 /c34 /c35 /c36 /c37 /c38 /c39 /c40 /c41 /c42 /c43 /c44 /c45 /c46 /c47 /c48 /c49 /c50 /c51 /c52 /c53 /c54 /c55 /c56 /c57 /c58 /c59 /c60 /c61 /c62 /c63 /c64 /c65 /c66 /c67 /c68 /c69 /c70 /c71 /c72 /c73 /c74 /c75 /c76 /c77 /c78 /c79 /c80 /c81 /c82 /c83 /c84 /c85 /c86 /c87 /c88 /c89 /c90 /c91 /c92 /c93 /c94 /c95 /c96 /c97 /c98 /c99 /c100 /c101 /c102 /c103 /c104 /c105 /c106 /c107 /c108 /c109 /c110 /c111 /c112 /c113 /c114 /c115 /c116 /c117 /c118 /c119 /c120 /c121 /c122 /c123 /c124 /c125 /c126 /c127 /c128 /c129 /c130 /c131 /c132 /c133 /c134 /c135 /c136 /c137 /c138 /c139 /c140 /c141 /c142 /c143 /c144 /c145 /c146 /c147 /c148 /c149 /c150 /c151 /c152 /c153 /c154 /c155 /c156 /c157 /c158 /c159 /c160 /c161 /c162 /c163 /c164 /c165 /c166 /c167 /c168 /c169 /c170 /c171 /c172 /c173 /c174 /c175 /c176 /c177 /c178 /c179 /c180 /c181 /c182 /c183 /c184 /c185 /c186 /c187 /c188 /c189 /c190 /c191 /c192 /c193 /c194 /c195 /c196 /c197 /c198 /c199 /c200 /c201 /c202 /c203 /c204 /c205 /c206 /c207 /c208 /c209 /c210 /c211 /c212 /c213 /c214 /c215 /c216 /c217 /c218 /c219 /c220 /c221 /c222 /c223 /c224 /c225 /c226 /c227 /c228 /c229 /c230 /c231 /c232 /c233 /c234 /c235 /c236 /c237 /c238 /c239 /c240 /c241 /c242 /c243 /c244 /c245 /c246 /c247 /c248 /c249 /c250 /c251 /c252 /c253 /c254 /c255 Encoding astore pop /String1 1 string def /CharProc { 0 1 translate 0 0 moveto -90 rotate String1 0 3 -1 roll mirror put 8 1 true [8 0 0 -1 0 1] {String1} imagemask } bind def /BuildChar {BuildCharDict begin .2 1 scale .75 0 0 0 1 1 setcachedevice gsave exch begin CharProc end grestore end } def end % ====================== End of GrafFont Definition ====================== % ------- Code to add Missing Characters to Courier Fonts ---------------- /strokewidth 40 def /halfsw strokewidth 2 div round cvi def /overshoot 15 def /capheight 563 halfsw sub def /capover capheight overshoot add def /baseline halfsw def /bover baseline overshoot sub def /xheight 417 halfsw sub def /xover xheight overshoot add def /ascend 604 halfsw sub def /aover ascend overshoot add def /descend -187 halfsw add def /ExpandFont % add two chars to Courier { exch dup length dict begin { 1 index /FID eq {pop pop} {def} ifelse } forall currentdict /UniqueID known {/UniqueID UniqueID 16#800000 xor def} if CharStrings length add dict begin CharStrings {def} forall currentdict end /CharStrings exch def currentdict end } def /Max {2 copy lt {exch} if pop}def /Min {2 copy gt {exch} if pop}def /courierdefs { } def /UpdateBBox { 5 -1 roll begin 3 -1 2 {/FontBBox load exch get Max 4 1 roll} for 1 -1 0 {/FontBBox load exch get Min 4 1 roll} for 4 array astore /FontBBox exch def end }def /Courier findfont 2 ExpandFont begin CharStrings begin /AE { pop 600 0 0 -251 600 700 setcachedevice /strokewidth 40 store /halfsw strokewidth 2 div round cvi store /overshoot 15 store /capheight 563 halfsw sub store /capover capheight overshoot add store /baseline halfsw store /bover baseline overshoot sub store /xheight 417 halfsw sub store /xover xheight overshoot add store /ascend 604 halfsw sub store /aover ascend overshoot add store /descend -187 halfsw add store newpath 30 baseline moveto 150 baseline lineto 90 baseline moveto 235 capheight lineto 550 403 moveto 550 capheight lineto 140 capheight lineto 320 capheight moveto 320 baseline lineto 240 baseline moveto 570 baseline lineto 570 140 lineto 165 208 moveto 320 208 lineto 320 292 moveto 440 292 lineto 440 347 moveto 440 237 lineto 1 setlinecap strokewidth 2 div setlinewidth stroke } def /ae { pop 600 0 0 -251 600 700 setcachedevice /strokewidth 40 store /halfsw strokewidth 2 div round cvi store /overshoot 15 store /capheight 563 halfsw sub store /capover capheight overshoot add store /baseline halfsw store /bover baseline overshoot sub store /xheight 417 halfsw sub store /xover xheight overshoot add store /ascend 604 halfsw sub store /aover ascend overshoot add store /descend -187 halfsw add store newpath 300 217 moveto 270 229 230 238 185 238 curveto 130 238 30 192 30 160 curveto 30 bover 38 add 100 bover 165 bover curveto 210 bover 255 bover 38 add 300 104 curveto 300 baseline moveto 300 308 lineto 300 364 250 xover 200 xover curveto 165 xover 130 xheight 90 379 curveto 560 67 moveto 516 bover 28 add 473 bover 430 bover curveto 360 bover 300 102 300 219 curveto 300 xover 100 sub 360 xover 430 xover curveto 500 xover 560 xover 100 sub 560 219 curveto 300 219 lineto 1 setlinecap strokewidth 2 div setlinewidth stroke } def end currentdict 0 -251 600 700 UpdateBBox /Encoding Encoding 256 array copy def Encoding 140 /AE put Encoding 143 /ae put currentdict end /Courier-E exch definefont pop /Courier-Bold findfont 2 ExpandFont begin CharStrings begin /AE { pop 600 0 0 -251 600 700 setcachedevice /strokewidth 100 store /halfsw strokewidth 2 div round cvi store /overshoot 15 store /capheight 583 halfsw sub store /capover capheight overshoot add store /baseline halfsw store /bover baseline overshoot sub store /xheight 437 halfsw sub store /xover xheight overshoot add store /ascend 624 halfsw sub store /aover ascend overshoot add store /descend -207 halfsw add store newpath 30 baseline moveto 150 baseline lineto 90 baseline moveto 235 capheight lineto 550 403 moveto 550 capheight lineto 140 capheight lineto 320 capheight moveto 320 baseline lineto 240 baseline moveto 570 baseline lineto 570 140 lineto 165 208 moveto 320 208 lineto 320 292 moveto 440 292 lineto 440 347 moveto 440 237 lineto 1 setlinecap 75 setlinewidth stroke } def /ae { pop 600 0 0 -251 600 700 setcachedevice /strokewidth 100 store /halfsw strokewidth 2 div round cvi store /overshoot 15 store /capheight 583 halfsw sub store /capover capheight overshoot add store /baseline halfsw store /bover baseline overshoot sub store /xheight 437 halfsw sub store /xover xheight overshoot add store /ascend 624 halfsw sub store /aover ascend overshoot add store /descend -207 halfsw add store newpath 300 217 moveto 270 229 230 238 185 238 curveto 130 238 30 192 30 160 curveto 30 bover 38 add 100 bover 165 bover curveto 210 bover 255 bover 38 add 300 104 curveto 300 baseline moveto 300 308 lineto 300 364 250 xover 200 xover curveto 165 xover 130 xheight 90 379 curveto 560 67 moveto 516 bover 28 add 473 bover 430 bover curveto 360 bover 300 102 300 219 curveto 300 xover 100 sub 360 xover 430 xover curveto 500 xover 560 xover 100 sub 560 219 curveto 300 219 lineto 1 setlinecap 75 setlinewidth stroke } def end currentdict 0 -251 600 700 UpdateBBox /Encoding Encoding 256 array copy def Encoding 140 /AE put Encoding 143 /ae put currentdict end /Courier-Bold-E exch definefont pop % ------- Code to add international character mapping -------------------- /reencsmalldict 5 dict def /ReEncodeSmall { reencsmalldict begin /newcodesandnames exch def /newfontname exch def /basefontname exch def /basefontdict basefontname findfont def /newfont basefontdict maxlength dict def basefontdict { exch dup /FID ne { dup /Encoding eq { exch dup length array copy newfont 3 1 roll put } { exch newfont 3 1 roll put } ifelse } { pop pop } ifelse } forall newfont /FontName newfontname put newcodesandnames aload pop newcodesandnames length 2 idiv { newfont /Encoding get 3 1 roll put} repeat newfontname newfont definefont pop end } bdf /CourierVectors % Ita Den Uk Ger Swe Fr Spa [ 129 /sterling % 35 35 35 35 130 /section % 64 64 93 64 132 /ring % 91 91 123 133 /ccedilla % 92 92 125 134 /eacute % 93 123 135 /ugrave % 96 136 /agrave % 123 137 /ograve % 124 138 /egrave % 125 125 139 /igrave % 126 % 140 /AE % 91 141 /Oslash % 92 142 /Aring % 93 93 % 143 /ae % 123 144 /oslash % 124 145 /aring % 125 125 146 /Adieresis % 91 91 147 /Odieresis % 92 92 148 /Udieresis % 93 149 /adieresis % 123 123 150 /odieresis % 124 124 151 /udieresis % 125 152 /germandbls % 126 153 /agrave % 64 154 /ugrave % 124 155 /dieresis % 126 156 /exclamdown % 91 157 /Ntilde % 92 158 /questiondown % 93 159 /ntilde % 124 ] def /TimesVectors % Ita Den Uk Ger Swe Fr Spa [ 129 /sterling % 35 35 35 35 130 /section % 64 64 93 64 132 /ring % 91 91 123 133 /ccedilla % 92 92 125 134 /eacute % 93 123 135 /ugrave % 96 136 /agrave % 123 137 /ograve % 124 138 /egrave % 125 125 139 /igrave % 126 140 /AE % 91 141 /Oslash % 92 142 /Aring % 93 93 143 /ae % 123 144 /oslash % 124 145 /aring % 125 125 146 /Adieresis % 91 91 147 /Odieresis % 92 92 148 /Udieresis % 93 149 /adieresis % 123 123 150 /odieresis % 124 124 151 /udieresis % 125 152 /germandbls % 126 153 /agrave % 64 154 /ugrave % 124 155 /dieresis % 126 156 /exclamdown % 91 157 /Ntilde % 92 158 /questiondown % 93 159 /ntilde % 124 ] def /makefonts % make all variations of international fonts, MouseText, Graphics { /Courier-Bold-E /My-Courier-Bold CourierVectors ReEncodeSmall /Courier-E /My-Courier CourierVectors ReEncodeSmall /Times-Roman /My-Times-Roman TimesVectors ReEncodeSmall /Times-Bold /My-Times-Bold TimesVectors ReEncodeSmall /MouseText MouseFont definefont pop /theGrafFont GrafFont definefont pop } bdf /BoldFont {/My-Courier-Bold findfont } bdf /RomanFont { /My-Courier findfont } bdf /PropRoman { /My-Times-Roman findfont } bdf /PropBold { /My-Times-Bold findfont } bdf % -------------------------------- /printfile %main job loop { initjob CmdDict begin { currentfile read % read one byte at a time % be sure not to send ^c,^d,^t,^s,^q { /NewPage? false store graf? not debug? not and {bitmask and} if % if not EOF, strip hi-bit printchar} % & handle char % if we got here then we're done. { NewPage? not CleanPage? not and % Do we need to flush the current page? {showpage} if % not if nothing is on the page. exit} ifelse } loop % repeat until EOF causes exit popCmdStack end %CmdDict } bdf /tabs 33 array def % allocate 33-element array /tabindex 0 def % point the index to the first element /current_tab 0 def % zero the current_tab pointer /reset_tabs % re-initialize the tab-setting array { 0 1 32 {tabs exch 999 put} for % put 999 in each array element /tabindex 0 store % point the index to the first element /current_tab 0 store % zero the current_tab pointer } bdf /InitVariables % default printer { /underline? false def % plain print /plain? true def /bold? false def /cpi 80 def % 10 chars per inch /LnHt 11.7 store /TopOfPage 775 store reset_tabs % no tabs set /lf? true def % linefeed direction switch T/F = forward/reverse /graf? false def /prop? false def /double? false def /open? false def /CR+LF? false def /dotspace 0 def /LeftMargin .25 72 mul store /slash0? false def /bitmask 127 def /LastString ( ) def /hexstring (0123456789ABCDEF) def /lowdig 0 def /hidig 0 def /debug? false def /str ( ) def /charct 1 def /NewPage? false def /CleanPage? false def /newcountry? false def /subflag false def /fonttype 0 def /autoLF? false def /CRonly? false def } bdf /ResetPrinter % default printer { /underline? false store % plain print /plain? true store /bold? false store /cpi 80 store % 10 chars per inch /LnHt 11.7 store /TopOfPage 775 store reset_tabs % no tabs set /lf? true store % linefeed direction switch T/F = forward/reverse /graf? false store /prop? false store /double? false store /open? false store /CR+LF? false store /dotspace 0 store /LeftMargin .25 72 mul store /slash0? false store /bitmask 127 store /lowdig 0 store /hidig 0 store /debug? false store /charct 1 store /NewPage? false store /CleanPage? false store /newcountry? false store /subflag false store /fonttype 0 store /autoLF? false store /CRonly? false store } bdf /strip {bitmask and}bdf /getchar {currentfile read pop strip}bdf /initjob { RomanFont 10 scalefont setfont InitVariables /linect 8 def /CmdDictBase countdictstack 1 add def initpage } bdf /initpage { LeftMargin TopOfPage moveto /linect 8 store } bdf % Caution => this program stacks dictionaries. Use "store" rather than % "def" to assign new values to old variables. /printchar % ( n -- ) this routine actually does the emulation { debug? {dup hexout} {dup cmd? graf? not and {doCmd } { /CleanPage? false store emit} ifelse } ifelse } bdf /hexout { dup 15 and hexstring exch get %convert low nble to int (asc of hex) /lowdig exch store %save result of conversion 240 and 16 idiv hexstring exch get %Convert High Nibble to Int(asc of hex) /hidig exch store %Save result of conversion. str 0 hidig put str show %convert Int(asc) to string and show it str 0 lowdig put str show %again for low Nibble ( ) show %Show a space /charct charct 1 add store charct 25 eq { /charct 1 store CR CR+LF? not {LF} if }if } bdf /cmd? % ( n -- b ) looks for command only in topmost dictionary { currentdict exch known} bdf /doCmd % as per the topmost dictionary, since doCmd is only invoked % if cmd? finds the command in the topmost dict. % default top dict: CmdDict {load exec } bdf /swapUSA % n -- n { mark % n mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 % n mark 1..127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapItaly { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 129 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 130 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 132 133 134 94 95 135 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 136 137 138 139 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapDenmark { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 140 141 142 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 143 144 145 126 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapEngland { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 129 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapGermany { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 130 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 146 147 148 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 149 150 151 152 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapSweden { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 146 147 142 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 149 150 145 126 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapFrance { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 129 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 153 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 132 133 130 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 134 154 138 155 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapSpain { mark 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 129 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 130 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 156 157 158 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 132 159 133 126 127 129 -1 roll 127 exch sub index 129 1 roll cleartomark }bdf /swapchar % replace chars where needed { mark % n m /swapSpain /swapFrance % n m c7 c6 /swapSweden /swapGermany % n m c7 c6 c5 c4 /swapEngland /swapDenmark % n m c7 c6 c5 c4 c3 c2 /swapItaly /swapUSA % n m c7 c6 c5 c4 c3 c2 c1 c0 country index % n m c7 c6 c5 c4 c3 c2 c1 c0 cn counttomark % n m c7 c6 c5 c4 c3 c2 c1 c0 cn num 1 add 1 roll % n cn m c7 c6 c5 c4 c3 c2 c1 c0 cleartomark % n cn cvx exec % n } bdf /emit % ( n -- ) convert ascii code to printable char, and show it. { swapchar % swap standard ascii for "local ascii" ( ) dup 0 4 -1 roll put dup show prop? { currentpoint exch dotspace add exch moveto} if underline? {dup doUnderline} if dup (0) eq {prop? not {slash0? {dup doslsh0} if } if} if /LastString exch store }bdf /doslsh0 % ( c -- ) char on stack is a zero now slash it. { % stack shown AFTER operations stringwidth pop % ( -- w ) get width of 0 in current font currentpoint % ( -- w x y ) get current cursor 3 1 roll exch sub % ( -- y x ) back to the start of the 0 exch % ( -- x y ) fix stack for moveto moveto (/) show % move and show a slash on top of the 0 } bdf /printable? % ( c -- c b ) is char in range (32..127) { dup 0 get 32 ge } bdf /doUnderline % ( c -- ) last-printed char is on stack. Now underline it. { % stack shown AFTER operations printable? {stringwidth pop dup % ( -- w w ) get width of char in current font currentpoint % ( -- w w x y ) get current cursor 3 sub % ( -- w w x y ) y-position for underline 3 1 roll exch sub % ( -- w y x ) line below character exch % ( -- w x y ) set up for moveto gsave 0 setlinewidth % save graphic state & set pen width newpath moveto % ( -- w ) start the path 0 rlineto stroke % ( x y ) stroke the line grestore % restore old graphic state puts us back where we were. } {pop} ifelse } bdf /CmdError % to handle errors during multi-character command sequences, % "emit" is redefined, thanks to dictionary stacking and % late-binding. See /EscDict below { popCmdStack emit } bdf /popCmdStack % clean up dict stack after completion of, or inturruption of, % multi-character command sequences. % CmdDictBase was defined in initjob. % CmdDict is never popped off the dict stack. { countdictstack CmdDictBase sub {end} repeat} bdf % routines to assist page handling -------------------------------------- /CR % cr only (no linefeed) { /current_tab 0 store LeftMargin currentpoint exch pop moveto CR+LF? {LF} if }bdf /LF % linefeed without cr -- ff if needed % linect was def'ed in initjob { CRonly? not { linect MaxLineCt LnHt sub ge {FF} { autoLF? { /current_tab 0 store LeftMargin currentpoint exch pop moveto } if /linect linect LnHt lf? { add } { sub } ifelse store currentpoint LnHt lf? { sub } { add } ifelse moveto } ifelse }if } bdf /FF % showpage and formfeed { CRonly? not { showpage initpage /current_tab 0 store /NewPage? true store /CleanPage? true store } if } bdf /BS %do a backspace. Like real imagwriter , only works one char back. { LastString % last string we printed stringwidth pop % ( -- w ) get it't width in current font currentpoint % ( -- w x y ) get current cursor 3 1 roll exch sub % ( -- y x ) back to the start of the last char exch % ( -- x y ) fix stack for moveto moveto } bdf %========================================================================= /LeftMargin .25 72 mul def /fsize 12 def % fontsize /LnHt 11.7 def % line height 12 = 6 lines/inch default /TopOfPage 775 def /MaxLineCt TopOfPage def /HT { HTDict begin (Htab ) print current_tab = flush tabs current_tab get % -- t get char tab position rel to left mar. dup 999 lt % -- t b if t < 999 then valid tab { 1 sub % -- t adjusted (n) stringwidth pop mul % -- p converted to points LeftMargin add currentpoint % -- ap x y ap = absloute points exch pop moveto /current_tab current_tab 1 add store } { pop } ifelse end } bdf %------------------------------------------------------------------------- /CmdDict 30 dict def % May need to be enlarged if you add a lot to it. CmdDict begin % Store the defs in CmdDict, rather than clutter % IWEmDict with all this stuff. 8 {graf? {8 emit} {BS} ifelse } bdf 9 {graf? {9 emit} {HT} ifelse} bdf 10 {graf? {10 emit} {LF} ifelse} bdf 12 {graf? {12 emit} {FF} ifelse } bdf 13 {graf? {13 emit} {CR} ifelse} bdf 27 {graf? {27 emit} {ESC} ifelse} bdf 14 { graf? { 14 emit} {/double? true store changeFontWidth} ifelse } bdf 15 { graf? { 15 emit} { /double? false store changeFontWidth} ifelse } bdf /changeFontWidth {fonttype 0 eq {doFont} {fonttype 1 eq {doMouseText} {gf} ifelse }ifelse } bdf /printfile %main job loop /Elite { /prop? true store /cpi 160 store doFont} bdf /Pica { /prop? true store /cpi 144 store doFont} bdf /doFont % scale selected font to appropriate "cpi" and make current { /fonttype 0 store cpi % ( -- n ) prop? { 160 eq { 10 } { 12 } ifelse bold? {PropBold} {PropRoman} ifelse } { 8 div 72 exch div 1.65 mul bold? {BoldFont} {RomanFont} ifelse } ifelse exch % ( -- font n ) get current font dict on stack double? { 2 mul }if 0 0 11.7 0 0 % load stack with matrix elements matrix astore % ( -- font n elems matrix ) make font-transform matrix makefont setfont } bdf /string4 4 string def /get4 % reads next 4 chars from input stream and % leaves them in string on stack { string4 % -- s create 4 char string on stack dup 0 getchar put % -- s put 1st char in str dup 1 getchar put % -- s put 2nd char in str dup 2 getchar put % -- s put 3rd char in str dup 3 getchar put % -- s put 4th char in str } bdf /inverse {255 exch sub } bdf /string3 3 string def /get3 % reads next 3 chars from input stream and { string3 dup 0 getchar put % -- s put 1st char in str dup 1 getchar put % -- s put 2nd char in str dup 2 getchar put % -- s put 3rd char in str } bdf /HTDict 20 dict def HTDict begin /add_a_tab % put into next sequential position in tabs array { tabs tabindex % str -- int array index 3 -1 roll % int array index -- array index int put % array index int -- /tabindex tabindex 1 add store % make index point to next array slot } bdf /get_tabs { { get3 cvi add_a_tab % take the first three chars as a tab getchar % the next char is either a , or a . 46 eq {exit} if % if it's a . then exit }loop } bdf /swap? % (n1 n2 -- n1 n2 b) if n1 > n2 then swap and put true on stack % else put false on stack { 2 copy gt { exch true } { false } ifelse } bdf /if_sort? % (array index -- bool) compares array[index] and array[index+1] % and leave bool on stack: % if array[index] < array[index+1] then swap & leave true % otherwise leave false { 2 copy 2 copy % a i -- a i a i a i 1 add % -- a i a i a i+1 get % -- a i a i n2 3 1 roll % -- a i n2 a i get exch % -- a i n1 n2 swap? % -- a i n1 n2 b { 4 1 roll % -- n2 a i n1 3 1 roll % -- n2 n1 a i 2 copy % -- n2 n1 a i a i 5 -1 roll % -- n2 a i a i n1 put 1 add % -- n2 a i+1 3 -1 roll % -- a i+1 n2 put true } % -- true { pop pop pop pop false } % a i n1 n2 -- false ifelse } bdf /sort_once % sort array once; leave true if a swap was done, else false { false % -- false 0 1 31 { tabs exch if_sort? % false -- false bool { pop true exit } if } for } bdf /sort_tabs % keep doing sort_once until flag is false % tabs array will end up like: % [n1,n2,n3,...,999,999,999] where n1<=n2<=n3<999 % current_tab will be set to first elem = 999, ie next % 'empty' tab slot {sort_once { sort_tabs} if % do until return flag is false /current_tab 0 store % start with tab[0] { tabs current_tab get 999 eq % n = 999? { exit } {/current_tab current_tab 1 add store } ifelse} loop } bdf /set_up_tabs { reset_tabs % define tabs array and set each element to 999 % set array indexes to 0 get_tabs sort_tabs % make sure tabs are in ascending sequence /current_tab 0 store % and make the first tab is the current one } bdf /remove_a_tab % nnn -- the tab to remove { 0 % nnn index start by looking at tabs[0] { dup tabs exch get % nnn index element 2 index % nnn index element nnn eq % nnn index b { tabs exch 999 % tabs index 999 put exit } { 1 add } % nnn index+1 ifelse }loop } bdf /remove_tabs % convert following string into integers and remove % remove tabs from tab array % then sort remaining tabs in ascending order { { get3 cvi remove_a_tab % take the first three chars as a tab getchar % the next char is either a , or a . 46 eq {exit} if % if it's a . then exit }loop sort_tabs % after array has changed, sort it /current_tab 0 store % and make the first tab is the current one } bdf end % HTDict /EscDict 100 dict def % may need to be enlarged /ESC % handle multi-character "escape" sequences { EscDict begin } bdf EscDict begin %------------------------------------- /subscript { currentpoint LnHt 6 div sub moveto /subflag true store }bdf /superscript { currentpoint LnHt 6 div add moveto /subflag false store }bdf /de-sub { currentpoint LnHt 6 div subflag {add} {sub} ifelse moveto } bdf /emit { CmdError } bdf /inch {72 mul} bdf /hDot % next 4 chars are dot position to move to { get4 cvi % i | convert to integer cpi div inch % convert to user-space units LeftMargin add currentpoint exch pop moveto } bdf /ignore % ( n -- | drop next n chars from input stream) { {currentfile read {pop} if} repeat } bdf /aStr 1 string def % make a str 1 char long /replicate % ( nnn c -- ) repeat next char nnn times { get3 cvi % times to repeat getchar dup % t c c 32 ge % t c b { aStr 0 % t c s 0 if it is a character, 3 -1 roll % t s 0 c print it put % the requested number of times {aStr show} repeat } % otherwise, { dup cmd? % t c b is it a command? {{doCmd} repeat}% if so, execute it t times {pop pop} % otherwise, it's not printable ifelse }ifelse } bdf /doMousetext { /fonttype 1 store cpi % ( -- n ) prop? { 160 eq { 12 } { 10 } ifelse } { 8 div 72 exch div} ifelse /MouseText findfont exch % ( -- font n ) get current font dict on stack double? {2 mul} if 0 0 8 0 0 % load stack with matrix elements matrix astore % ( -- font n elems matrix ) make font-transform matrix makefont setfont } bdf /gf % print graphic bytes { /fonttype 2 store cpi prop? { 160 eq { 12 } { 10 } ifelse } { 8 div 72 exch div} ifelse .828125 mul /theGrafFont findfont exch % ( -- font n ) get current font dict on stack double? {2 mul} if 0 0 8 0 0 % load stack with matrix elements matrix astore % ( -- font n elems matrix #) make font-transform matrix makefont setfont } bdf /gprint { /graf? true store { currentfile read pop printchar 1 sub dup 0 eq {pop exit} if } loop /graf? false store doFont } bdf /g4 { get4 cvi gf gprint} bdf /g3*8 { get3 cvi 8 mul gf gprint} bdf /repeatGraphic { /graf? true store get4 cvi % -- # times to print char gf aStr 0 currentfile read pop put { aStr show} repeat /graf? false store doFont } bdf /dps { pop } bdf % proportional dot spacing /string2 2 string def /get2 % reads next 2 chars from input stream and % leaves them in string on stack { string2 % -- s create 2 char string on stack dup 0 getchar put % -- s put 1st char in str dup 1 getchar put % -- s put 2nd char in str } bdf /aChar 1 string def /FixCR+LF % LF after CR ?? { aChar dup 0 getchar put % -- s put 1st char in str cvi 1 eq {/CR+LF? true store} {/CR+LF? false store} ifelse } bdf /SetMargin { get3 cvi cpi prop? { 160 eq {80} {72} ifelse % proportional "look-alikes" }if 8 div 72 exch div mul .25 72 mul add /LeftMargin exch store} bdf /ChangeSwitch {currentfile read pop %Switch number 1 dup 128 and 128 eq {open? {/CR+LF? false store} %SW 1-8 yes or no linefeed + cr {/CR+LF? true store} ifelse } if dup 64 and 64 eq { open? {/CRonly? true store} %SW 1-7 CR only or CR,LF,VT,FF {/CRonly? false store} ifelse } if dup 32 and 32 eq {open? {/bitmask 255 store} %SW 1-6 yes or no ignore bit 8 {/bitmask 127 store} ifelse } if dup 4 and 4 eq {open? {/country country 3 and store} %SW 1-3 Language selector {/country country 4 or store} ifelse /newcountry? true store } if dup 2 and 2 eq {open? {/country country 5 and store} %SW 1-2 Language selector {/country country 2 or store} ifelse /newcountry? true store } if 1 and 1 eq {open? {/country country 6 and store} %SW 1-1 Language selector {/country country 1 or store} ifelse /newcountry? true store } if currentfile read pop %switch number 2 1 and 1 eq {open? {/slash0? false store} {/slash0? true store} %SW 2-1 Slash 0's yes or no. ifelse } if newcountry? { doFont /newcountry? false store } if } bdf /changeLnHt { get2 cvi 2 div /LnHt exch store } bdf /makedotspace { aChar dup 0 getchar put % -- s put 1st char in str cvi cpi 72 exch div mul /dotspace exch store } bdf /movedot {cpi 72 exch div mul 0 rmoveto} bdf % ESC ! 1B 21 Start Bold Print 33 { /bold? true store doFont popCmdStack } bdf % ESC " 1B 22 End Bold Print 34 { /bold? false store doFont popCmdStack } bdf % ESC $ 1B 24 Select 96 ASCII Characters 36 {doFont popCmdStack} bdf % ESC & 1B 26 Select MouseText Characters 38 {doMousetext popCmdStack } bdf % ESC ' 1B 27 Select Down-loaded Characters 39 { 0 ignore } bdf % ESC ( 1B 28 Set Horizontal Tab 40 { HTDict begin set_up_tabs end popCmdStack} bdf % ESC ) 1B 29 Clear Horizontal Tab 41 { HTDict begin remove_tabs end popCmdStack } bdf % ESC * 1B 2A Select Down-loaded Characters 42 { 0 ignore } bdf % ESC + 1B 2B Down load 8-dot-wide characters 43 { 0 ignore } bdf % ESC - 1B 2D Down load 16-dot-wide characters 44 { 0 ignore } bdf % ESC 0 1B 30 Clear All Horizontal Tabs 48 { HTDict begin reset_tabs end popCmdStack} bdf % ESC 1 1B 31 1-dot proportional spacing 49 { 1 movedot popCmdStack } bdf % ESC 2 1B 32 2-dot proportional spacing 50 { 2 movedot popCmdStack } bdf % ESC 3 1B 33 3-dot proportional spacing 51 { 3 movedot popCmdStack } bdf % ESC 4 1B 34 4-dot proportional spacing 52 { 4 movedot popCmdStack } bdf % ESC 5 1B 35 5-dot proportional spacing 53 { 5 movedot popCmdStack } bdf % ESC 6 1B 36 6-dot proportional spacing 54 { 6 movedot popCmdStack } bdf % ESC < 1B 3C Bi-directional Printing 60 { 0 ignore popCmdStack} bdf % ESC > 1B 3E Uni-directional Printing 61 { 0 ignore popCmdStack} bdf % ESC ? 1B 3F Self ID 62 { 0 ignore popCmdStack} bdf % ESC A 1B 41 Set 1/6" line spacing 65 { /LnHt 11.7 store popCmdStack} bdf % ESC B 1B 42 Set 1/8" line spacing 66 { /LnHt 9 store popCmdStack} bdf % ESC D dd 1B 43 dd Reset switches to closed 68 {/open? false store ChangeSwitch popCmdStack} bdf % ESC E 1B 45 Select 12 cpi text, 96 dpi graphics 69 { /cpi 96 store /prop? false store doFont popCmdStack} bdf % ESC F nnnn 1B 46 dddd Begin printing at dot-position nnnn 70 { hDot popCmdStack} bdf % ESC G nnnn 1B 47 dddd Next nnnn bytes to be printed as bit-image graphics 71 { g4 popCmdStack } bdf % ESC H nnnn 1B 48 nnnn Set forms length in 1/144" increments 72 {4 ignore popCmdStack} bdf % ESC I 1B 49 Begin character download sequence 73 {0 ignore popCmdStack} bdf % ESC K n 1B 4B n Select color n 75 { 1 ignore popCmdStack} bdf % ESC L nnn 1B 4C nnn Set left margin nnn 76 { SetMargin popCmdStack} bdf % ESC M 1B 4D Select NLQ font 77 { 0 ignore } bdf % ESC N 1B 4E Select 10 cpi text, 80 dpi graphics 78 { /cpi 80 store /prop? false store doFont popCmdStack } bdf % ESC O 1B 4F Overide paper-out sensor 79 { 0 ignore } bdf % ESC P 1B 50 Select elite proportional text, 160 dpi graphics 80 { Elite popCmdStack} bdf % ESC Q 1B 51 Select 17 cpi text, 136 dpi graphics 81 { /cpi 136 store /prop? false store doFont popCmdStack } bdf % ESC R nnn 1B 52 nnn Repeat next character nnn times 82 { replicate popCmdStack } bdf % ESC S nnnn 1B 53 nnnn Next nnnn bytes to be printed as bit-image graphics 83 {g3*8 popCmdStack} bdf % ESC T nn 1B 54 nn Set nn/144" line spacing 84 { changeLnHt popCmdStack} bdf % ESC V nnnn 1B 56 nnnn Repeat following 1 byte dot pattern nnnn times 86 {repeatGraphic popCmdStack} bdf % ESC W 1B 57 Select full-height characters 87 { 0 ignore } bdf % ESC X 1B 58 Start underline 88 { /underline? true store popCmdStack} bdf % ESC Y 1B 59 Stop underline 89 { /underline? false store popCmdStack} bdf % ESC Z dd 1B 5A dd Reset switches to OPEN 90 {/open? true store ChangeSwitch popCmdStack} bdf % ESC a n 1B 61 n Select font n 97 { 1 ignore } bdf % ESC c 1B 63 Software RESET 99 { ResetPrinter popCmdStack} bdf % ESC e 1B 65 Select 13.4 cpi text, 107 dpi graphics 101 { /cpi 107 store /prop? false store doFont popCmdStack} bdf % ESC f 1B 66 Select forward linefeed 102 { /lf? true store popCmdStack} bdf % ESC g nnn 1B 67 nnn Next (nnn * 8) bytes to be printed as bit-image graphics 103 { gr3*8 popCmdStack} bdf % ESC l n 1B 6C n Disable (n=0) / Enable (n=1) optional linefeed 108 { /autoLF? getchar 48 sub 0 eq store popCmdStack} bdf % ESC m 1B 6D Select Standard font 109 { 0 ignore } bdf % ESC n 1B 6E Select 9 cpi text, 72 dpi graphics 110 { /cpi 72 store /prop? false store doFont popCmdStack } bdf % ESC o 1B 6F Enable paper-out sensor 111 { 0 ignore } bdf % ESC p 1B 70 Select pica proportional text, 144 dpi graphics 112 { Pica popCmdStack} bdf % ESC q 1B 71 Select 15 cpi text, 120 cpi graphics 113 { /cpi 120 store /prop? false store doFont popCmdStack } bdf % ESC r 1B 72 Select reverse linefeed 114 { /lf? false store popCmdStack} bdf % ESC s 1B 73 n set proportional spacing to n 115 { makedotspace popCmdStack } bdf % ESC u 1B 75 Set additional tabs 117 { HTDict begin get3 add_a_tab sort_tabs popCmdStack } bdf % ESC v 1B 76 Set Top-of-Form 118 { 0 ignore } bdf % ESC w 1B 77 Select half-height characters 119 { 0 ignore } bdf % ESC x 1B 78 Select superscript characters 120 { superscript popCmdStack } bdf % ESC y 1B 79 Select subscript characters 121 { subscript popCmdStack } bdf % ESC z 1B 7A De-select super/sub characters 122 { de-sub popCmdStack} bdf end % EscDict -------------------------------- end % CmdDict end % IWEmDict % end of program "IWEM"