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
[131x2]
but let's start with a postscript dialect and then see if we can 
retrofit draw to it.
that way we are not constrained by draw.
Geomol
7-Apr-2006
[133]
Then I just need a list of PS commands to get started on the dialect.
Graham
7-Apr-2006
[134x3]
since rebol3 is coming, and View may well change, it makes less sense 
to stick to the past.
this has a reference at the end : http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html
Is this works, you can then render your paint images to postscript 
printers :)
Geomol
7-Apr-2006
[137]
Is it the "Index of Operators" in the link, you gave?
Graham
7-Apr-2006
[138]
yes.
Geomol
7-Apr-2006
[139]
add, arc, ...translate
Graham
7-Apr-2006
[140x6]
yes.
pen red
            line 30x30 50x20 70x70 40x50
newpath
	1 0 0 setrgbcolor
	30 30 moveto
	50 20 lineto
	70 70 lineto
	40 50 lineto
	stroke
pen blue
            box 20x20 80x80
newpath
	0 0 1 setrgbcolor
	20 20 moveto
	60 0 rlineto
	0 60 rlineto
	-60 0 rlineto
	closepath stroke
that's sort of equivalent in my understanding
Geomol
7-Apr-2006
[146]
PostScript dialect test ready. Try this:
do http://home.tiscali.dk/postscript/postscript.r
s: postscript [font ["Times-Roman" 20] ["Hello World!"]]


s is now the PostScript output, that can be saved to a PS-file or 
sent to a printer.
Rebolek
7-Apr-2006
[147]
I've got 404 :(
Graham
7-Apr-2006
[148]
is that url correct?
Geomol
7-Apr-2006
[149x3]
no :) 2 seconds
do http://home.tiscali.dk/john.niclasen/postscript/postscript.r
Sorry about that.
Graham
7-Apr-2006
[152]
>> do http://home.tiscali.dk/john.niclasen/postscript/postscript.r
connecting to: home.tiscali.dk

** User Error: Error.  Target url: http://home.tiscali.dk/john.niclasen/postscript/postscript.r
could not be retr
ieved.  Server respons...

** Near: do http://home.tiscali.dk/john.niclasen/postscript/postscript.r
>>
Geomol
7-Apr-2006
[153]
Local cache?
Graham
7-Apr-2006
[154x2]
less haste less waste ! :)
no,it's a 404 response.
Rebolek
7-Apr-2006
[156]
same here
Geomol
7-Apr-2006
[157x4]
It worked for me just before, now it doesn't!?? Weird, I get same 
error now.
I'll check with ftp ...
Strange, I can see the script on the server with ftp, but I can't 
reach it with browser or rebol.
Any ideas?
Graham
7-Apr-2006
[161]
must be a case problem.
Cyphre
7-Apr-2006
[162]
works here ok, must be a connection problem
Geomol
7-Apr-2006
[163]
yes, try now
Rebolek
7-Apr-2006
[164]
now it works
Geomol
7-Apr-2006
[165]
Now it works. It seems, it take a little time, before tiscali makes 
content reachable.
Graham
7-Apr-2006
[166]
Ok, looks okay.  But each element needs to be placed on the page.
Geomol
7-Apr-2006
[167]
?
Graham
7-Apr-2006
[168x3]
you need to tell the postscript engine where to place the text.
eg. 72 72 moveto
which is one inch from the left bottom edge
Geomol
7-Apr-2006
[171]
It's a start.
What happen, if you leave out that part?
Graham
7-Apr-2006
[172x3]
nothing happens I suspect.
there's also a postscript preamble or header.
%!PS-Adobe-3.0
%%Creator: Synapse-EMR 3.01
%%LanguageLevel: 2
Geomol
7-Apr-2006
[175x3]
Oh, misunderstood.
Try:
s: postscript [font ["Times-Roman" 20] [at 72x72 "Hello World!"]]
You can position with AT pair!
Now the dialect has to be defined precisely with all the functionality, 
we want.
Graham
7-Apr-2006
[178x2]
gsave
 .75 setgray
 /Helvetica-Bold findfont 72 scalefont setfont
 72 100 moveto
 (Hello World!)	 show
 grestore
I would save the state and then restore it.
Geomol
7-Apr-2006
[180]
I need to learn more about PostScript.