Click for: WEBPAGE INDEXweb page updated Thursday 8th May 2003 1115pm USE GHOSTSCRIPT AS A TYPEWRITER! Screen shot of output of example below, this screen shot was done using the new AGA WB scrolling viewer on a 32 colour screen, it uses the OS colour matching which isnt perfect! For typing with GS you need some language layer otherwise its a real pain, thus use my own language layer: type.ps. The problem is that GS uses a coordinate system with the wrong origin + wrong axes directions wrong measure etc. Thus to make it user friendly use the above file. All commands beginning with Upper case initial letter are my own commands, so if you look inside the above file anything beginning with lower case is an inbuilt PS command eg show is the inbuilt PS command for printing text. Begin by calling gs as usual with the above file as input, eg gs_000 -sDEVICE=epson type.psThis will take you immediately to the GS> prompt. Now try this: GS> (Hello world!)show GS> (this is a test)show GS> Newline GS> 255 255 0 Square GS> (see a yellow square?)show GS> 0 255 255 Square GS> Newline (:cyan square)show GS> Newline GS> /NimbusSanL-Regu Font GS> (:new font being set)show GS> 5 Fontsize /NimbusSanL-Regu Font GS> Newline GS> (Big 5cm!)show GS> Newline GS> 1 Fontsize /NimbusSanL-Regu Font GS> (smaller font!, see gs8data:fontmap.gs)show GS> Newline GS> (for all available fonts)show GS> Print This can also be done from a pre-made file, eg: gs_000 -sDEVICE=somedevice type.psThen at the GS> prompt type: GS> (typetest) run Where the file typetest contains the above commands, this makes life a lot easier to debug the PS file. You can also add your own language layer to extend type.ps. You can do all this directly with PS but its a lot of work as eg the units of measurement are 1/72 inch, Also PS does rgb colours with floating point values between 0 and 1 for each component. type.ps retargets this to the traditional computer 0-255 values! type.ps keeps track of vertical position on the page, the Newline procedure resets the position to the start of the next line. By using my type.ps layer file, you have user friendly usage of GS for text using all GS fonts in gs8data:fontmap.gs and any other ps fonts. Thus you can write a letter with commercial quality printout just armed with GS and type.psHandwritten Postscript generally requires debugging eg one line may collide with another or run off the edge. eg the above example had some bugs, now removed! Also with each page printed everything gets reset, thus my Print procedure reinitializes the page each time, otherwise when you try a second page it will be just blank! Really using the GS> prompt is just like using the BASIC language on eg a BBC computer of yester-year. A procedure for automatically doing newlines would be /Line {show Newline} def, you could feed this new procedure in at the GS> and immediately start using it. USE GHOSTSCRIPT AS A CALCULATOR: gs_000 To multiply eg 12.3 x 13.8: GS> 12.3 13.8 mul == To add use add, likewise use sub, div, To do (2 + 3)/4: GS> 2 3 add 4 div == GS is a stack machine, if we present it with a number, it pushes it onto the stack. When we present it with an operator eg add it pops the operands from the stack, applies the operator and pushes the answer onto the stack. To pop + view the top thing on the stack you type ==. So eg to add 1 2 3 4 5 we could type: GS> 1 2 3 4 5 add add add add == If the GS prompt says eg GS> < 4 > that means there are 4 unpopped things on the stack. Its useful for debugging.

Get a GoStats hit counter