World: r3wp
[Postscript] Emitting Postscript from REBOL
older newer | first last |
Graham 7-Apr-2006 [290x2] | PostScript normally uses units of "points" for placing graphics on the page. I find it more convenient to work with centimeters. I got the following snippet of PostScript code from a public domain program called "GLE" which I believe is available at any large ftp site; I recommend this graphics program. By examining the PostScript output of that program I collected the following piece of PostScript code: matrix currentmatrix /originmat exch def /umatrix {originmat matrix concatmatrix setmatrix} def [28.3465 0 0 28.3465 10.5 100.0] umatrix What this basically does is rescale the page so that now all following commands will work as if the centimeter is the basic unit of length. This places (0,0) near the bottom left of the page and (21,24) near the top right of the page. If you don't do this, then (0,0) is the bottom left corner of the page and (612,792) is the top right corner of the page (if you are using an 8 1/2 inch by 11 inch sheet of paper). These are the default PostScript units; 72 of these to an inch. 28.3465 to a centimeter, thus the numbers above in the last line of PostScript code. |
taken from http://www.physics.emory.edu/~weeks/graphics/howtops1.html | |
Henrik 7-Apr-2006 [292] | it does? |
Graham 7-Apr-2006 [293x2] | John, what version is that script ? I see 0.1.1 |
I think my isp heavily caches so I can't see new stuff. | |
Geomol 7-Apr-2006 [295x5] | version 0.2.0 now. Refresh! |
New version with cm! do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [setcm linewidth 20 path [setgray 0.5 at 2.5 2 boxfill 8 12]]] | |
setcm seems to influence font size. Try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [font [Times-Roman 1] setcm linewidth 0.5 path [setgray 0.5 at 2.5 2 box 8 12] path [at 5x8 rotate 45 "Hello World!"]]] | |
AT can both be specified as a pair and 2 numbers. | |
I can't find the switch y-axis thing right now. Maybe a matrix is needed? | |
Graham 7-Apr-2006 [300] | well, my postscript printer printed out a gray box! |
Geomol 7-Apr-2006 [301x3] | Wow! :) |
We're not all lost then! ;-) | |
Good news. :) | |
Graham 7-Apr-2006 [304] | You should really put the %!PS header in. |
Geomol 7-Apr-2006 [305x2] | Comments come last. |
% mean comment. | |
Graham 7-Apr-2006 [307x2] | I know. It tells the printer what is coming. |
whether it's postscript, pdf or whatever. | |
Geomol 7-Apr-2006 [309] | ahh, then I'll put it in now. Just: %!PS ? |
Graham 7-Apr-2006 [310x2] | sure. |
%!PS-Adobe-3.0 %%Creator: postscript.r ver 0.2.0 | |
Geomol 7-Apr-2006 [312] | done |
Henrik 7-Apr-2006 [313] | so both "at 3x3" and "at 3 3" can be used? |
Geomol 7-Apr-2006 [314x3] | yes |
New version with line, try: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r write %test.ps postscript [page [linewidth 5 path [setgray 0.8 line 72x72 100x72 102.5 87.3 200x115]]] | |
again coords can be a pair or 2 numbers, also decimals. | |
Henrik 7-Apr-2006 [317] | setcm doesn't seem to work here... |
Geomol 7-Apr-2006 [318x2] | When setcm is used, max coords is 20 or so to be within page. |
21x24 | |
Henrik 7-Apr-2006 [320] | no it stops parsing when the word 'setcm is reached |
[unknown: 9] 7-Apr-2006 [321] | I have not been watching this very close, so to get me up to speed....you are writing an emitter from Rebol to PS? |
Geomol 7-Apr-2006 [322] | Reichart, yes. |
Henrik 7-Apr-2006 [323x2] | reichart: http://www.hmkdesign.dk/ps.png |
(OSX converts it to PDF) | |
[unknown: 9] 7-Apr-2006 [325] | Cool. |
Henrik 7-Apr-2006 [326] | it's also really small |
Geomol 7-Apr-2006 [327] | just a basic one with text and some graphics. |
[unknown: 9] 7-Apr-2006 [328] | how about pulling a "NeXT" and making a PS VID? : ) |
Geomol 7-Apr-2006 [329] | hehe |
[unknown: 9] 7-Apr-2006 [330] | Gabriele is writing a PDF emitter for MakeDoc and QML. |
Henrik 7-Apr-2006 [331] | reichart, shush! Steve Jobs might be reading this. |
[unknown: 9] 7-Apr-2006 [332] | : ) |
Geomol 7-Apr-2006 [333] | 150 lines of code so far. Can be seen here: http://home.tiscali.dk/john.niclasen/postscript/postscript.r |
Henrik 7-Apr-2006 [334] | I think Sun also made a PS window manager |
[unknown: 9] 7-Apr-2006 [335x2] | Yeah, I was reading the code as I posted. |
Very cool. | |
Henrik 7-Apr-2006 [337] | it's primarily to make more methods for graphical printing with rebol |
[unknown: 9] 7-Apr-2006 [338] | Postscript is copyrighted? |
Henrik 7-Apr-2006 [339] | I hope not? |
older newer | first last |