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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Henrik
8-Jun-2006
[1082x3]
pekr, made my own system so problem temporarily solved, but it's 
still a problem for those with a fast sampling mouse
I tried running view on my old A4000/040 25 Mhz once. it was utterly 
useless.
graham, the barcode is drawn as an image and then pasted into the 
preview
Pekr
8-Jun-2006
[1085]
Henrik - View was several times optimised. E.g. all-over events it 
used initially, and later on, Holger did some other improvements. 
But yes, Graham may be right, that for complex apps it is slow. OTOH 
we could see things really optimised by gurus. E.g. when I last looked 
at EMR, it was based upon many tabs. If all tabs are in fact in memory, 
then it could be a resource hog.
Graham
8-Jun-2006
[1086]
I doubt that windows 98/95 has the graphics heap to support it
Henrik
12-Jun-2006
[1087x5]
graham, how long does it take for you to print the first page of 
the 20000 leagues... test page in your demo?
oh... was a postscript error.
>> do http://www.compkarori.com/reb/psd2draw5.r
** PostScript error at: [
    flow-translate 50x0
    flowbox 0x140 250x720
    grestore
    gsave
    flow-translate 310x0
    flowbox
]
the error comes when I try to print
geomol, can you post the links to your postscript docs again?
Geomol
12-Jun-2006
[1092x2]
http://home.tiscali.dk/john.niclasen/postscript/postscript.r
http://home.tiscali.dk/john.niclasen/postscript/test.txt
http://home.tiscali.dk/john.niclasen/postscript/test.png
I didn't make documentation.
Graham
12-Jun-2006
[1094x2]
Henrik, I mentioned above that I ran out of time to finish the translation 
to postscript
I need to read up on postscript justification routines
Henrik
12-Jun-2006
[1096x2]
graham, sorry I missed it
geomol, thanks. maybe it's worth mentioning on rebol weekly?
Geomol
12-Jun-2006
[1098x3]
sure, I'll make a post in rebolweek group.
Some old news.

REBOL PostScript dialect: http://home.tiscali.dk/john.niclasen/postscript/postscript.r

Example of use:http://home.tiscali.dk/john.niclasen/postscript/test.txt

Result should look like this:http://home.tiscali.dk/john.niclasen/postscript/test.png

The dialect is useful for simple postscript output, even if I think, 
it has some design flaws. It require too many blocks, I think. I 
haven't had time to evolve the dialect further, but anyone is welcome 
to pick it up. There's no documentation, so you have to look in the 
source to figure out the keywords.
Do this in a REBOL prompt to run the test:

do http://home.tiscali.dk/john.niclasen/postscript/postscript.r

write %test.ps postscript load http://home.tiscali.dk/john.niclasen/postscript/test.txt

Now the file %test.ps holds the postscript output.
Henrik
12-Jun-2006
[1101]
geomol, is page size locked to A4?
Henrik
13-Jun-2006
[1102]
http://partners.adobe.com/public/developer/en/ps/sdk/5041.Text_Setting.pdf
<--- some light reading on text adjustment in PS
Geomol
13-Jun-2006
[1103]
There is no page-format code in the dialect. I'm not sure, what default 
is with postscript (A4 or US letter).
Henrik
13-Jun-2006
[1104]
looks like you need to parse AFM files to get the width information 
out of your font files to make proper font justification. so we need 
to build an AFM parser?
Volker
13-Jun-2006
[1105]
Gab has the metrics in pdf-viewer?
Henrik
13-Jun-2006
[1106x6]
seems that it's not necessary, but I'm not sure when it's not necessary. 
there is a direct function to get the stringwidth precisely and through 
that create some simple PS code to center a string
haven't tried printing it yet though...
just tried it. works fine. looks like this could be simple to implement 
with text boxes in postscript.r
geomol, I've implemented a very primitive centering algorithm now 
in postscript.r. It will only center one line and requires a horizontal 
size to center from. do you want this code?
got right alignment working too now. what next? :-)
http://hmkdesign.dk/aligndemo.ps
Graham
13-Jun-2006
[1112]
Henrik, the difficulty is not so much formatting a single line of 
text, but a large block of text of unknown size which may cross multiple 
pages.  PS has functions to exactly allow you to calculate the stringwidth 
of a string, count spaces, etc and these help in writing justification 
routines.  Some complex justification routines are available  ... 
just requires tracking them down if one doesn't want to learn PS 
:)
Henrik
13-Jun-2006
[1113]
well, I could do a little digging, but no guarantees. what postscript.r 
can do now is exactly what I need.
Geomol
14-Jun-2006
[1114]
Henrik, I haven't used postscript.r for anything other than test 
so far. We could upload it to the library with your additions. A 
problem then is, if the dialect change too much, and many has used 
it for real, it will maybe break their code. Another way forward 
would be, that you give me your extended postscript.r, and I upload 
it to my web-page, and we keep it there for now. When the dialect 
has evolved some more (, and we get rid of all the blocks, that I 
wrote about above), we can then upload it to the library.
Henrik
14-Jun-2006
[1115]
geomol, yeah I think we should keep it "under wraps" so far, let 
people play with it with a huge disclaimer that this is alpha code 
which may change in the future. I think the addition is useful, but 
my implementation is not clean. I also added support for ISOLatin1 
so we can print Danish letters.
Gabriele
14-Jun-2006
[1116]
I have Volker's AFM parser that I used for the PDF Maker around, 
if anyone needs it. (But I guess Volker has it somewhere too :)
Volker
14-Jun-2006
[1117]
Maybe not. It was so long ago, and i hava - Hmm, i guess i have a 
copy of pdf-makerwith it somewhere :)
Henrik
18-Jun-2006
[1118]
postscript.r seems to work fine on HP printers, but I can't get it 
to work on certain OKI printers. guess the header needs some finetuning...
Graham
10-Aug-2006
[1119x3]
I have a new method of printing now using PostScript which does not 
require any custom PostScript dialects.  It appears to work well 
so far.
It is primarily for printing documents as opposed to diagrams etc 
which may be better suited for a dialected approach.
I shall have to find some time to write a mini tutorial on the subject.
Geomol
6-Nov-2006
[1122x4]
REBOL postscript dialect version 0.3.0: http://home.tiscali.dk/john.niclasen/postscript/postscript.r

New thing is, that you don't have to make all those blocks as in 
the prior version. Also alignment of text is possible and output 
is ISOLatin1 encoding, both thanks to Henrik. I should write some 
documentation soon!
Do this in a REBOL prompt to run the test:

do http://home.tiscali.dk/john.niclasen/postscript/postscript.r

write %test.ps postscript load http://home.tiscali.dk/john.niclasen/postscript/test.txt

Now the file %test.ps holds the postscript output.
The test output looks like this: http://home.tiscali.dk/john.niclasen/postscript/test.png

We would like tests on different PS-printers! Hopefully it should 
work everywhere!?
Also new font options are included. bold and italic is valid words 
inside the font block. And "Times" can be written as "Times" or "Times-Roman", 
upper- lower-case doesn't matter, the dialect should figure it out.
xavier
6-Nov-2006
[1126]
i just tried it ... and got no ps reader ... what should i use for 
reading it ? adobe acrobat ?
Geomol
6-Nov-2006
[1127]
xavier: ghostscript maybe!? Depends on your OS. If you have a PS-net-printer, 
it's also possible to send it to a port on the printer.
xavier
6-Nov-2006
[1128]
yes i just realised how stupid is my question .... i go to pick ghostscript 
and try it
Graham
6-Nov-2006
[1129]
Use gsview ...
Geomol
6-Nov-2006
[1130]
On net-printers, port 9100 will probably work. On parallel-port-printers, 
I guess the output should be sent ot lpt1:
!?
Graham
6-Nov-2006
[1131]
correct