Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1950 > unrolled thread
| Started by | idol programmer <idprog@trust.com> |
|---|---|
| First post | 2014-08-06 11:51 +0100 |
| Last post | 2014-08-06 22:47 -0700 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.lang.postscript
Understanding driver output idol programmer <idprog@trust.com> - 2014-08-06 11:51 +0100
Re: Understanding driver output ken <ken@spamcop.net> - 2014-08-06 16:14 +0100
Re: Understanding driver output rodd@panix.com (Rod Dorman) - 2014-08-06 19:06 +0000
Re: Understanding driver output Ross Presser <rpresser@gmail.com> - 2014-08-06 12:13 -0700
Re: Understanding driver output ken <ken@spamcop.net> - 2014-08-07 07:57 +0100
Re: Understanding driver output luser- -droog <mijoryx@yahoo.com> - 2014-08-06 22:47 -0700
| From | idol programmer <idprog@trust.com> |
|---|---|
| Date | 2014-08-06 11:51 +0100 |
| Subject | Understanding driver output |
| Message-ID | <53e208bb$0$49555$c3e8da3$fdf4f6af@news.astraweb.com> |
In my quest to understand a bit more about postscript I've been looking at what comes out of a Windows Postscript printer driver. Here's an example: 5582 1340 M (Hello)S 6149 1340 M (World)S I think this displaying the text Hello World, but it's using M and S instead of moveto and show. These "aliases" seem to have been defined at the top the file: %%BeginResource: file Pscript_Win_Basic 5.0 0 /d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^ /index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/- /rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true , d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C /closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M /rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , etc. I assume this is done to try and reduce the file size? Is this normal practice elsewhere?
[toc] | [next] | [standalone]
| From | ken <ken@spamcop.net> |
|---|---|
| Date | 2014-08-06 16:14 +0100 |
| Message-ID | <MPG.2e4c5699fe9e4e669898c5@usenet.plus.net> |
| In reply to | #1950 |
In article <53e208bb$0$49555$c3e8da3$fdf4f6af@news.astraweb.com>, idprog@trust.com says... > In my quest to understand a bit more about postscript I've been looking > at what comes out of a Windows Postscript printer driver. Umm, that's a bit like trying to understand assembly language by looking at what comes out of a compiler. Machine generated PostScript isn't easy to follow. > Here's an example: > > 5582 1340 M (Hello)S > 6149 1340 M (World)S > > I think this displaying the text Hello World, but it's using M and S > instead of moveto and show. > > These "aliases" seem to have been defined at the top the file: They aren't what I would call aliases. PostScript is a programming language, so you can define routines and call them in your program. In this case you have routines called 'M' and 'S' (PostScript is case sensitive) > I assume this is done to try and reduce the file size? Is this normal > practice elsewhere? Its normal practice everywhere for printer drivers/application output, yes. There's much less excuse for it since we all stopped using 9600 bps serial lines to send PostScript to printers, but old habits never die. Ken
[toc] | [prev] | [next] | [standalone]
| From | rodd@panix.com (Rod Dorman) |
|---|---|
| Date | 2014-08-06 19:06 +0000 |
| Message-ID | <lrtubb$cje$1@reader1.panix.com> |
| In reply to | #1951 |
In article <MPG.2e4c5699fe9e4e669898c5@usenet.plus.net>, ken <ken@spamcop.net> wrote: >In article <53e208bb$0$49555$c3e8da3$fdf4f6af@news.astraweb.com>, >idprog@trust.com says... >> ... >> I assume this is done to try and reduce the file size? Is this normal >> practice elsewhere? > >Its normal practice everywhere for printer drivers/application output, >yes. There's much less excuse for it since we all stopped using 9600 bps >serial lines to send PostScript to printers, but old habits never die. It was also handy back when the only network you had was Sneakernet and you had to make it fit on a floppy. -- -- Rod -- rodd(at)polylogics(dot)com
[toc] | [prev] | [next] | [standalone]
| From | Ross Presser <rpresser@gmail.com> |
|---|---|
| Date | 2014-08-06 12:13 -0700 |
| Message-ID | <28946358-edf6-409a-8f17-ace4079dee1b@googlegroups.com> |
| In reply to | #1953 |
On Wednesday, August 6, 2014 3:06:19 PM UTC-4, Rod Dorman wrote: > In article <MPG.2e4c5699fe9e4e669898c5@usenet.plus.net>, ken > <ken@spamcop.net> wrote: > >In article <53e208bb$0$49555$c3e8da3$fdf4f6af@news.astraweb.com>, > >idprog@trust.com says... > >> ... I assume this is done to try and reduce the file size? > >> Is this normal practice elsewhere? > > > >Its normal practice everywhere for printer drivers/application > >output, yes. There's much less excuse for it since we all stopped > >using 9600 bps serial lines to send PostScript to printers, but > >old habits never die. > > It was also handy back when the only network you had was > Sneakernet and you had to make it fit on a floppy. It can also be handy, still, during development. If your generated Postscript doesn't work for whatever reason, you can tweak the M routine in one place, instead of globally searching for moveto and adding extra code everywhere.
[toc] | [prev] | [next] | [standalone]
| From | ken <ken@spamcop.net> |
|---|---|
| Date | 2014-08-07 07:57 +0100 |
| Message-ID | <MPG.2e4d33b5c253a2949898c6@usenet.plus.net> |
| In reply to | #1954 |
In article <28946358-edf6-409a-8f17-ace4079dee1b@googlegroups.com>, rpresser@gmail.com says... > It can also be handy, still, during development. If your generated > Postscript doesn't work for whatever reason, you can tweak the M > routine in one place, instead of globally searching for moveto and > adding extra code everywhere. You can do that anyway, just redefine /moveto Ken
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2014-08-06 22:47 -0700 |
| Message-ID | <fbc2c98f-935f-4e11-9be4-1139af4a4f8b@googlegroups.com> |
| In reply to | #1950 |
On Wednesday, August 6, 2014 5:51:31 AM UTC-5, idol programmer wrote: > In my quest to understand a bit more about postscript I've been looking > at what comes out of a Windows Postscript printer driver. > > Here's an example: > > 5582 1340 M (Hello)S > 6149 1340 M (World)S > > I think this displaying the text Hello World, but it's using M and S > instead of moveto and show. > > These "aliases" seem to have been defined at the top the file: > > %%BeginResource: file Pscript_Win_Basic 5.0 0 > /d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin > , d/^ > /index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto > , d/- > /rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , > d/T/true , > d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , > d/D/awidthshow , d/C > /closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto > , d/-M > /rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , > etc. > > > I assume this is done to try and reduce the file size? Is this normal > practice elsewhere? Yes, it's very much the common way to structure a postscript program to separate it into a Prolog and a Script. It helps get you into the mindset of aggressively factoring your code. As others have commented this practice also helps reduce the size of the program, and thus storage and transmission requirements. In the past, storage and transmission efficiency were more vital than they are now. But the benefit for the programmer has always been -- and remains -- the power of abstraction to reduce the level of detail necessary to write or review an implementation of an algorithm. So the Prolog+Script style is merely good Structured Programming technique made into a convention. I highly recommend you read the Glenn Reid books: the Green Book, and Thinking in Postscript. He gives an excellent overview of how to write postscript code for a printer driver.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web