r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Postscript] Emitting Postscript from REBOL

Graham
7-Apr-2006
[251x2]
that was bad programming.
it relied a printer deficiency to work.
Henrik
7-Apr-2006
[253x2]
I didn't discover the error until I tried it on the expensive printer. 
besides the size and position of the line was supposed to be correct. 
the barcode was created with PDF Maker
and it looks correct when viewed in a PDF Viewer
Graham
7-Apr-2006
[255]
even when you drill down on the bars to high resolution?  Remember 
screen res is only 72 dpi .. lower than your cheap printer.
Geomol
7-Apr-2006
[256]
PS has setlinewidth, and setting it to 0 will make is as thin, as 
the device can do.
Graham
7-Apr-2006
[257x4]
John, before we go further in developing this, I would like to know 
what license is going to be applied.  I note that yu have copyright 
nicomsoft in the header.
I think it would be good if someone could produce some draw scripts 
of varying difficulty, and then we can see how far we can get in 
rendering these to ps.
easiest might be some text and lines .. then boxes, circles, fills 
.. then gradient fills etc.
like a test suite for any dialect that is written.
Geomol
7-Apr-2006
[261x4]
Funny, I was just thinking about that. I think, I'll just make the 
first dialect being a small subset of PS, and then license can be 
the one, Carl talked about in a blog. Was it BSD?
Free for all use.
We could then put it in the Library, and others can develop it further. 
(Maybe that should be coordinated somehow?)
Is that ok?
Henrik
7-Apr-2006
[265x3]
graham, even if I take a good PDF viewer and zoom all the way in
so it's probably a problem with the printer, but still one that should 
be solvable by setting the width of the line jsut a few hair's width 
thicker
geomol, BSD license is yummy. please proceed. :-)
Graham
7-Apr-2006
[268x2]
BSD is good.
I've only done bar code printing using bar code fonts .. not directly 
in pdf-maker.
Henrik
7-Apr-2006
[270x3]
http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=ean13.r
<--- did this one a year ago. it uses PDF maker to generate barcodes
it can also generate bitmapped barcodes. works only with EAN13 format 
though
hmm... seems I forgot to upload the version that actually can use 
PDF Maker :-)
Geomol
7-Apr-2006
[273x2]
New version! Try:
do http://home.tiscali.dk/john.niclasen/postscript/postscript.r
print postscript [page [path [linewidth 10 at 72x72 box 72 72]]]
I only test it on the screen under MacOS, where there is an automatic 
converter. Can someone test it on a PS printer?
Henrik
7-Apr-2006
[275x2]
how do you convert it? I can't make preview.app read it
ah, problem fixed
Geomol
7-Apr-2006
[277x3]
I do:

write %test.ps postscript [page [path [linewidth 10 at 72x72 box 
72 72]]]
and then open test.ps with Finder.
ok :)
Maybe box shouldn't be inside a path block, but be an instance of 
itself?
Henrik
7-Apr-2006
[280]
I have no idea...
Geomol
7-Apr-2006
[281]
What is best?
page [path [at 72 72 box 100 100]]
or 
page [box 72 72 100 100]
Henrik
7-Apr-2006
[282]
the first one is most readable
Geomol
7-Apr-2006
[283]
Try:
do http://home.tiscali.dk/john.niclasen/postscript/postscript.r

write %test.ps postscript [page [linewidth 5 path [setgray 0.5 at 
72.5 72 boxfill 72 72]]]
Henrik
7-Apr-2006
[284]
wonderful!
Geomol
7-Apr-2006
[285]
I guess, linewidth mean nothing in that example and can be left out. 
Sorry about that!
Henrik
7-Apr-2006
[286]
I wonder if it's possible to flip the coordinate system to match 
that of DRAW
Geomol
7-Apr-2006
[287]
I read something about that...
Graham
7-Apr-2006
[288x4]
draw starts 0x0 at bottom left ?
you can write postscript functions that translate from one coordinate 
to another.
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!