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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Graham
10-Apr-2007
[1315x2]
yes ...
you need a bounding box in your ps file
Henrik
10-Apr-2007
[1317x2]
oh, hang on. there was a combination of things I didn't try here...
nope, happily ignored
Graham
10-Apr-2007
[1319]
try some other ps files generated by other apps
Henrik
10-Apr-2007
[1320x6]
still ignores it, but I think I figured out why it does that.
it behaves like a printer with letter paper in it. and just scales 
anything to fit in it.
if I ask for a print preview and specifically ask for A5 paper, it 
clips the drawing like a printer would
created a postscript knowlegde base checklist
caving in and trying to do this with imagemagick. :-(


however it does not load .ps files (no delegate), even though it 
says so with "identify -list format" in the console
oh, ghostscript is needed for this....
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 :-)