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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Henrik
13-Apr-2006
[520]
now to redesign the API. it's too clunky right now
Graham
13-Apr-2006
[521x2]
that looks pretty neat!
I take it that was much harder to do in pdf-maker.r ??
Henrik
13-Apr-2006
[523x2]
it's a bit harder but not much different
actually only the text was harder because in PS you point to a position 
and start writing, where you in PDF-maker need to define a text box 
before writing
Graham
13-Apr-2006
[525]
Is this EAN ?
Henrik
13-Apr-2006
[526x2]
EAN13
works fine with barcode readers. have tested with both cheap and 
expensive ones. just need a good printer
Graham
13-Apr-2006
[528]
where's the barcode function?
Henrik
13-Apr-2006
[529x2]
http://www.hmkdesign.dk/rebol/barcode/ean13.r
do %postscript.r
do %ean13.r
ean13-ps ean13-create "123456789012" ; 12-digit code

will output a block to be inserted in the postscript block
Graham
13-Apr-2006
[531]
Ok, not trivial !
Henrik
13-Apr-2006
[532]
a bit clunky
Graham
13-Apr-2006
[533]
Luckily I have no need for a barcode at present.
Henrik
13-Apr-2006
[534x2]
the string is necessary, but I should probably put the create function 
inside the barcode generator function
you can take any 12 digit string, but the 13th digit is a checksum 
which must be correct or the barcode can't be read
Graham
13-Apr-2006
[536]
http://www.compkarori.com/reb/test2.pdf
Henrik
13-Apr-2006
[537]
neat
Graham
13-Apr-2006
[538]
make-circles: func [ count /local out ][
	out: copy []
	loop count [

  repend out [ 'newpath 'circle to-pair reduce [ random 700 random 
  700 ] random 40 
			'color 
			to-tuple rejoin [ random 255 "." random 255 "." random 255 ]
			'fill
		] 
	]
	out
]

test5: form ps/header compose [
	gsave
	(make-circles 500)
	grestore
	showpage
]
Henrik
13-Apr-2006
[539x2]
I think it's bedtime... can hardly see the code anymore
night
Graham
13-Apr-2006
[541x9]
borrow some matchsticks to keep the eyelids open!
night
this is a multipage postscript file
ps/header [
	newpage "Title"
	at 72x72 font Times-Roman 12 "page 1"
	showpage
	newpage "Body"
	at 144x144 "page 2"
	showpage
]
and produces this postscript output
%!PS-Adobe-3.0 
%%Creator: ps.r ver 0.0.6 
%%Pages: (atend) 
%%EndComments 
%%Page: Title 1 
72 72 moveto /Times-Roman findfont 
12 scalefont 
setfont 
(page 1) show 
showpage 
%%Page: Body 2 
144 144 moveto (page 2) show 
showpage 

%%Trailer 
%%Pages: 2 
%%EOF
http://www.compkarori.com/reb/starburst.pdfis a starburst
http://www.compkarori.com/reb/clipped.pdfare the words "REBOL Rulz" 
clipped to the starburst.
ie . the starburst is only visible inside the text.
Graham
14-Apr-2006
[550x3]
looks like port 9100 is pretty standard for most postscript printers
if a print server has multiple printers attached, they are likely 
to be on different ports eg, 9101, 02 ...
newpath sets up a new line which can be drawn.  Stroke has the same 
effect as newpath
Geomol
14-Apr-2006
[553x2]
Does moveto always indicate a newpath?
If it does, the basic rule of the dialect might be: at <pos> <content>
And then we get rid of blocks.
Graham
14-Apr-2006
[555x4]
no, it doesn't.
my next step is to now convert the ps dialect to draw - so I can 
have a print preview ( confined to lines, boxes and text ).
anyone know what the draw coordinates mean?  What is point 20x20 
.. measured from the top left, but what is 20 based upon?
I've looked at http://www.rebol.com/docs/draw-ref.htmland it doens't 
mention how the coordinate system is based.
Henrik
14-Apr-2006
[559]
it's probably pixel based
Graham
14-Apr-2006
[560x3]
screens are 72 dots per inch.
postscript is 72 points per inch.
Good match!
Henrik
14-Apr-2006
[563]
strange coincidence
Graham
14-Apr-2006
[564x3]
unlikely to be a coincidence.
A4                              595 x 842
   Letter                          612 x 792
so to change postscript to draw, for A4, it's 842 - y
Geomol
14-Apr-2006
[567]
If you have a 15" monitor showing say 1280x1024 and you have a 21" 
monitor with same resolution, you don't have 72 dots per inch on 
both.
Graham
14-Apr-2006
[568]
how to convert a gray ( range 0 - 1 ) to a tuple! ?
JaimeVargas
15-Apr-2006
[569]
Graham, Postscript is resolution independant. Certainly capable of 
more than 72dpi