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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Geomol
10-Apr-2007
[1326]
A couple of useful PS links:

How to generate portable Postscript: http://alumni.media.mit.edu/~szummer/postscript/

What is the physical size of the page?: http://www.postscript.org/FAQs/language/node64.html

How to use Adobe PostScript language files properly.: http://www-cdf.fnal.gov/offline/PostScript/AdobePS.html

(Look under "Paper bin, tray, size, feed mode, etc. selection", where 
you also find a link to:)
PostScript Sins: http://www.byte.com/art/9508/sec13/art3.htm
Gripes: http://www.cs.wisc.edu/~ghost/doc/gripes.htm
Henrik
10-Apr-2007
[1327]
Geomol, I made a checklist for links
Geomol
10-Apr-2007
[1328]
oki
Henrik
10-Apr-2007
[1329x3]
feel free to put stuff in there :-)
Geomol, I've added EPS output, bounding box and page orientation 
to postscript.r. This is done with a 'preamble which is followed 
by a block.
and then the page [...] stuff comes.
Geomol
10-Apr-2007
[1332]
Ok, about your page size, I think, it'll give more problems, if you 
specify A4 or Letter explicit. It's better to make some margin, so 
the pages can be printed on both types of paper.
Henrik
10-Apr-2007
[1333]
possibly... I've noticed that Preview doesn't care much about page 
sizes or page orientation while Ghostview does.
Geomol
10-Apr-2007
[1334]
Regarding landscape, then I think, it's just a comment in PS (%%PageOrientation) 
used for previewing.
Henrik
10-Apr-2007
[1335]
yes, tried it.
Geomol
10-Apr-2007
[1336x2]
It may be more clear, if we look at PS as a low level language to 
control some type of printer or typesetter. It goes like: move to 
this position, print this text using this font, move to this other 
position, print text, ...

Landscape is done with 90 degree rotation before doing the print 
command.
If the position is off the side of the paper, it's tough luck and 
will be cut.
Henrik
10-Apr-2007
[1338]
which is also why it would be tough to do in VID, since it does not 
have a method for easy 90 degree rotation of text
Geomol
10-Apr-2007
[1339]
Yup, better to use the DRAW dialect.
Henrik
10-Apr-2007
[1340]
well, DRAW can't use proper centering and right alignment... somehow 
this reminds me of a toolbox with a broken hammer and bent nails...
Geomol
10-Apr-2007
[1341]
hmm... *thinking*
Henrik
10-Apr-2007
[1342]
I've discussed this with Gabriele and it was thought that it would 
be enough to have the bounding box available for each char. This 
way we could do proper typesetting.
Graham
10-Apr-2007
[1343]
Must be a change of heart occuring .. Carl said he never imagined 
anyone doing type setting with Rebol!
Geomol
10-Apr-2007
[1344]
That's the force of REBOL! :-) You can't possible think of all the 
things, you can and will do with it.
Henrik
10-Apr-2007
[1345]
well, DRAW uses bounding box to render text, but it does not bring 
that information further up to REBOL level, so we can take advantage 
of it.
Geomol
10-Apr-2007
[1346]
Henrik, is it some thing like the function SIZE-TEXT, you're after 
with text in DRAW?
Henrik
10-Apr-2007
[1347]
geomol, yes. SIZE-TEXT does not work that well with DRAW text.
Geomol
10-Apr-2007
[1348]
right :/
Henrik
10-Apr-2007
[1349]
but a basic thing like placing text according to the baseline is 
also missing. this is also not brought up to REBOL level.
Geomol
10-Apr-2007
[1350x2]
Have you played with MATRIX and text in DRAW?
I remember, I got some funny results, when I made Canvas RPaint. 
There's the mirror effect. I can't remember, how it affected text, 
and I can't test it right now, as my PC is packed away and it DRAW 
text doesn't work under OS X.
Henrik
10-Apr-2007
[1352]
I haven't figured out how MATRIX works
Geomol
10-Apr-2007
[1353x5]
Yeah, it's a bit tricky. There's a link in the DRAW docs to: http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace
where you might get some explanation.
It's about vector algebra.
Short explanation: matrix [1 0 0 1 0 0]
is neutral and doesn't do anything.
matrix [1 0 0 1.5 0 0]
scale the y-direction by 1.5.
matrix [1 0 0 1 100 0]
translate in the x-direction by 100 pixels.
So the most basic stuff (scaling and moving) goes like this:
matrix [scale-x 0 0 scale-y move-x move-y]
Result depend on what you put in those 4 positions.
Henrik
10-Apr-2007
[1358]
I see, though I'm not sure what advantage this gives. Is it because 
it's fast?
Geomol
10-Apr-2007
[1359x5]
The last 2 zeros are used for the SKEW effects.
It's just a general way of combining different effects.
If you wanna do more than one transformation, they can be combined 
into one matrix command.
So yes, it might be faster, if you have lots of transformations going 
on.
I gotta go reading some stuff, examination tomorrow. Have fun with 
your postscript! :-) I'm looking forward to see some good results.
Henrik
10-Apr-2007
[1364]
good luck :-)
Geomol
10-Apr-2007
[1365]
thanks
Geomol
23-Feb-2008
[1366]
Does anyone have experience with PageSize in PostScript? Typical 
ps files have something like this in the setup part:

%%BeginFeature: *PageSize A4

    <</PageSize [595 842] /ImagingBBox null>> setpagedevice
%%EndFeature
Henrik
23-Feb-2008
[1367x2]
I messed around with it a bit to get it to print on A5 sheets, but 
ended up just drawing on the A5 area.
geomol, are you planning updates to postscript.r?
Geomol
23-Feb-2008
[1369x2]
Yes, if it's a good idea to put pagesize in there. I did a test and 
missed some lines in the top of my document, when producing ps output.
Are there anything special, you need in postscript.r?
Henrik
23-Feb-2008
[1371x3]
I was afraid of messing with it, since only a single error, such 
as leaving a standard postscript command out or putting another one 
in, caused some printers to stop working with it.
There is a bug with printing multiple pages on certain HP printers. 
After the first page, some char is missing, that causes it to wait 
until you press the Online button or page feed button. I really would 
like that to be fixed. The work-around is to print to a file and 
have it printed using Printfile under Windows.
And I also badly need bitmap support :-)
Geomol
23-Feb-2008
[1374]
Ok, I try to stick to the standard and keep things simple.
Henrik
23-Feb-2008
[1375]
well, I tried standard commands, but it seems that printers and postscript 
is like HTML and webbrowsers, unfortunately.